日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

使用forfiles 刪除幾天前的數(shù)據(jù)

 湖畔書韻 2012-02-25
使用forfiles 刪除幾天前的數(shù)據(jù)
 
rem 刪除前一天的歷史數(shù)據(jù)
forfiles /m *.fc /s /D -1 /c "cmd /c del @file"

rem 刪除當(dāng)前目錄下及其子目錄中的空文件夾
for /f "tokens=*" %a in ('dir /b /ad /s E:\FileCache^|sort /r') do rd "%a" /q 2>nul

在批處理中把%改成%%
for /f "tokens=*" %%a in ('dir /b /ad /s E:\FileCache^|sort /r') do rd "%%a" /q 2>nul

Forfiles

windows server 2003內(nèi)置命令

開關(guān)很少,p路徑,m 方式,s包含子目錄,c執(zhí)行命令,d日期

普通使用可能比不上for,dir等, 但是c這個(gè)開關(guān)很強(qiáng)大的

command string:
@file    - returns the name of the file.
@fname   - returns the file name without extension.
@ext     - returns only the extension of the file.
@path    - returns the full path of the file.
@relpath - returns the relative path of the file.
@isdir   - returns "TRUE" if a file type is a directory, and "FALSE" for files.
@fsize   - returns the size of the file in bytes.
@fdate   - returns the last modified date of the file.
@ftime   - returns the last modified time of the file.


FORFILES /P C:\WINDOWS /S /M DNS*.*
列出windows及其子目錄下DNS開頭的所有文件

FORFILES /S /M *.txt /C "cmd /c type @file | more"
列出當(dāng)前目錄以及子目錄下所有的txt文檔的內(nèi)容,并以分頁的形式打印出來

FORFILES /P C:\ /S /M *.bat
列出windows及其子目錄下的bat文件

FORFILES /D -30 /M *.exe /C "cmd /c echo @path 0x09 was changed 30 days ago"

列出30天內(nèi)修 改過的exe文件,列出路徑+自定義文字0x09(tab) was changed 30 days ago

FORFILES /D 2001/01/01 /C "cmd /c echo @fname is new since Jan 1st 2001"

列出 2001、0101后的文件并打印文檔名字+is new since Jan 1st 2001

FORFILES /D +2009/4/10 /C "cmd /c echo @fname is new today"

列出20090410后修改過的文 件,并打印

FORFILES /M *.exe /D -1

列出一天前到現(xiàn)在修改過的exe文件
FORFILES /S /M *.doc /C "cmd /c echo @fsize"

列出doc文件,并打印出文件大小

FORFILES /M *.txt /C "cmd /c if @isdir==FALSE notepad.exe @file"

列出txt文件, 如果不是文件夾,那么就依次用notepad打開該文件,關(guān)閉后開啟下一個(gè)文件。

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多