Batch files can be created for customized tasks such as cleaning up older system, or copying files from one folder to another as a backup.
Note that the PATH in the given code should be substituted by the path where you would like your files to be deleted. If there are no spaces in the path, the - symbol is not needed.
This command can be saved in a .bat file and may be scheduled with other automated tasks.
N.B. More than one directory may be included in this command.
Batch Script Command to Delete Files
If you would like to create a batch script that can be used to copy files older than 30 days from one folder to another, while simultaneously deleting the old files from the source folder, here's a sample batch script that can automate the task:forfiles /p "PATH" /s /d -30 /c "cmd /c del @file : date >= 30 days >NUL"
Note that the PATH in the given code should be substituted by the path where you would like your files to be deleted. If there are no spaces in the path, the - symbol is not needed.
This command can be saved in a .bat file and may be scheduled with other automated tasks.
N.B. More than one directory may be included in this command.
No comments:
Post a Comment