WebStep 1. Left-click the Windows main menu and search for Command Prompt. Right-click the result and select the “Run as administrator” option. Step 2. Type in ForFiles /p “C:pathtofolder”/s /d -X /c “cmd /c del /q @file” to delete files on Windows that haven’t been modified in the last X days and press Enter. WebJan 16, 2024 · CMD delete files older than X days in specific folders. Ask Question. Asked 5 years, 2 months ago. Modified 5 years, 2 months ago. Viewed 5k times. 0. I have few …
How to Delete Files Older Than X Days on Windows 11/10 with File ...
WebNov 5, 2015 · Here you are: pushd \\folder1 forfiles /M *.doc /D -30 /C "cmd /C if @isdir==FALSE move @file .\archive\" forfiles /M *.xls /D -30 /C "cmd /C if @isdir==FALSE move @file .\archive\" popd Due to the syntax you used for the source directory path ( \\folder1\) I suppose it is given by a UNC path. WebJun 7, 2024 · The time of last modification time of a file or directory is usually returned without second value in date/time string. Best is to find out with following batch file best executed before 10:00 AM what are the formats on current machine for current user. @echo off echo Current date/time: %DATE% %TIME% for %%I in ("%~f0") do echo Batch file … how to write a thesis examples
How to Delete Files Older than N Days Automatically in Windows
WebTo delete files older than 10 days in Windows 11 or Windows 10, you can use the ForFiles command. First, open the Command Prompt with administrator rights. Then, enter this … WebDec 1, 2015 · List only files in current folder which are older than 30 days. Output shouldn't include directories and subdirectories. This should list files similar as "ls" command does. Output should look like file1 file2 file3 .. I used find . -mtime +30. but this gives files and files in sub-directories as well. I would like to restrict doing search ... WebMar 23, 2024 · For read and delete I am using those command at putty . for count: ls /tmp/ grep 'ci_session*' wc -l for Delete files: cd /tmp/ find . -name "ci_session*" -exec rm {} \; #Update: for delete, i want to delete only 1 hr older files. Here I want to add condition if total files are greater than 1000, then call delete command. orion curve beam