We used the wildcard operator "*" in our first example, and specified. /m instructs the command to use the given search mask./s instructs the command to search sub-directories.the directory you want to delete the files from /p details the path to start searching i.e.the commands will apply to each file fitting the command arguments forfiles allows us to use commands for each file in a location i.e.docx /d -3 /c "cmd /c del batch file commands and switches in use here are: docx file extension older than three days: forfiles /p "C:\some\file\name\here" /s /m *. The first example deletes files in the specified folder older than three days: forfiles /p "C:\some\file\name\here" /s /m * /d -3 /c "cmd /c del second example only deletes files with the. Furthermore, you can use the batch file script to delete a specific file type or a group of files in a folder, so long as they meet the criteria expressed in the commands. You set the maximum age range for the files in the batch file, allowing you to customize the process. You can use a batch file to scan for and then delete files older than a certain amount of days. Delete Files Older Than a Certain Time Using a Batch File start does the obvious and starts the program.Ģ.displays the command currently being executed in a command shell.The batch file commands in this file are: You can add as many applications and files as you want to the batch file. Start – "C:\Program Files\Microsoft Office\Office15\WINWORD.EXE"Ĭd "C:\Program Files (x86)\VMware\VMware Player" Open a new text file and input: echo offĬd "C:\Program Files\Google\Chrome\Application\" In the example below, I'm opening the Google Chrome browser, a Word document I'm working on, and VMware Player.
0 Comments
Leave a Reply. |