且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

批量文件删除超过N天的文件

更新时间:2023-12-04 21:06:52

享受:

forfiles -p "C:\what\ever" -s -m *.* -d <number of days> -c "cmd /c del @path"

请参阅 forfile文档详细信息。

有关更多好处,请参阅 a href =http://www.ss64.com/nt/ =noreferrer> Windows XP命令行的AZ索引

For more goodies, refer to An A-Z Index of the Windows XP command line.

如果您的机器上没有安装 forfiles ,请从任何 Windows Server 2003 到您的Windows XP机器%WinDir%\system32\ 。这是可能的,因为EXE在Windows Server 2003和Windows XP之间完全兼容。

If you don't have forfiles installed on your machine, copy it from any Windows Server 2003 to your Windows XP machine at %WinDir%\system32\. This is possible since the EXE is fully compatible between Windows Server 2003 and Windows XP.

Windows和Windows Server的较新版本默认安装。

Later versions of Windows and Windows Server have it installed by default.

对于Windows 7:

For Windows 7:

语法有所改变。因此更新的命令是:

The syntax has changed a little. Therefore the updated command is:

forfiles -p "C:\what\ever" -s -m *.* /D -<number of days> /C "cmd /c del @path"