Windows bat批處理刪除指定N天前的檔案
Windows下bat批處理,自動獲取檔案的最後修改時間,然後將指定多少天之前的檔案刪除,需要Windows支援forfiles命令,XP及以上系統都自帶forfiles命令。
刪除指定目錄下7天前的檔案(目錄為C:\test):
forfiles /p "c:\test" /s /m *.* /d -7 /c "cmd /c del @path"
刪除批處理檔案當前目錄下7天前的檔案:
forfiles /p %~dp0 /s /m *.* /d -7 /c "cmd /c del @path"
將以上其中一行復制,新建文字檔案,貼上並儲存為bat格式,定期執行或者加入計劃任務。
顯示當前目錄下七天以前的檔案路徑
forfiles /p %cd% /s /m *.* /d -7 /c "cmd /c echo @path"
相關文章
- windows刪除幾天前檔案的批處理命令Windows
- Windows下批次刪除N天前的檔案Windows
- windows刪除檔案的批處理操作Windows
- bat批處理檔案BAT
- bat批處理徹底刪除0KB頑固檔案BAT
- linux自動刪除N天前檔案Linux
- 在WINDOWS下刪除幾天前的檔案Windows
- windows下刪除前一天備份批處理Windows
- Windows Linux 刪除N天之前的檔案指令碼WindowsLinux指令碼
- 【轉載】windows下刪除指定日期前的檔案Windows
- 編寫簡單的windows bat批處理指令碼檔案WindowsBAT指令碼
- Windows批處理檔案Windows
- 批處理檔案 bat 後臺執行BAT
- 電腦如何利用Bat刪除文字檔案指定字串?BAT字串
- windows cmt bat批處理中的註釋WindowsBAT
- 用批處理實現的刪除特定時間以前的檔案
- 批處理刪除語句
- linux下刪除指定日期前的檔案Linux
- windows自帶刪除forfiles命令批處理詳解Windows
- 批處理檔案(bat檔案)註冊dll批量註冊dllBAT
- bat處理檔案BAT
- bat檔案處理BAT
- 批處理獲得系統當前時間之前n天的時間
- window定時刪除批處理
- bat批處理使用ren批次重新命名檔案,比如批次去掉檔名稱的前4位BAT
- Git刪除指定檔案Git
- bat 批處理字串操作BAT字串
- 查詢一天前的日誌檔案刪除
- 永久刪除 Windows 2000 預設本地 C, D 盤共享的兩個批處理檔案 (轉)Windows
- 刪除前一天的備份的一個簡單批處理
- 批處理-刪除環境變數變數
- 使用bat批處理命令打包maven專案BATMaven
- window 批處理檔案
- 批處理檔案命令
- 批處理以當前時間為檔名建立檔案
- Windows批處理(cmd/bat)常用命令小結WindowsBAT
- Linux下批量刪除空檔案或者刪除指定大小的檔案Linux
- sql server 2008中執行bat批處理檔案SQLServerBAT