I have the code below which renames a specific file, in this case 16919.csv appending the date on the end and putting it in a folder of the same name as the original file. However I have this same batch file setup for multiple file names. What id like is for the command to grab the name of the file and use that to run the commands below. So I can have one file to rename multiple files of different names. How is this possible?
@echo off
for /f "delims=" %%a in ('wmic OS Get localdatetime ^|find "."') do set "dt=%%a"
set "YY=%dt:~2,2%"
set "YYYY=%dt:~0,4%"
set "MM=%dt:~4,2%"
set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%"
set "Min=%dt:~10,2%"
set "Sec=%dt:~12,2%"
set datestamp=%DD%%MM%%YYYY%
set timestamp=%HH%%Min%%Sec%
set fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%
ren "16919.csv" "/16919/16919 - %datestamp%.csv"