运行批处理文件,该文件将删除30天以前的文件夹(及其子文件夹)中的文件

时间:2021-08-11 02:08:13

I want to run a batch file that would delete files in a folder (and its sub folders) that are older then 30 days. I'm somewhat new to scripting so any help would be appreciated. The path to the folder is C:\Documents and Settings\user profile\Application Data\Program\Program\folder\company name

我想运行一个批处理文件,该文件将删除30天以前的文件夹(及其子文件夹)中的文件。我对脚本有些陌生,所以任何帮助都会受到赞赏。该文件夹的路径是C:\ Documents and Settings \用户配置文件\ Application Data \ Program \ Program \ folder \ company name

That folder has many random sub folders - I need the batch file to delete any file in those subfolders older then 30 days.

该文件夹有许多随机子文件夹 - 我需要批处理文件删除那些早于30天的子文件夹中的任何文件。

Is this something that can be done with a batch file or would I need a higher level script like vb scripting?

这可以通过批处理文件完成,还是需要更高级别的脚本,如vb脚本?

1 个解决方案

#1


2  

I did some copy and paste for you from here:

我从这里为你做了一些复制和粘贴:

forfiles -p "C:\what\ever" -s -m *.* /D -30 /C "cmd /c del @path"

See forfile documentation for more details.

有关详细信息,请参阅forfile文档。

#1


2  

I did some copy and paste for you from here:

我从这里为你做了一些复制和粘贴:

forfiles -p "C:\what\ever" -s -m *.* /D -30 /C "cmd /c del @path"

See forfile documentation for more details.

有关详细信息,请参阅forfile文档。