I want to rename all file in a specified folder ending with .txt to .csv that are older then 1 day. I have the following that will get me all files ending with .txt and rename them to .csv
For /R %1 %%G IN (*.txt) DO ren "%%G" "%%~nG.csv"
The part I am struggling with is only renaming the files that are older then a day. I am looking for a solution that will work despite the date format that may be set up on a system.
You would use "forfiles". The code would be:
forfiles /m "*.txt" /c "cmd /c Ren @fname.txt *.csv" /d -01
That will rename all .txt files to .csv files.
Ren *.txt was changed to @fname.txt