I'm trying to append the date to a filename that changes daily and not coming up with a good way to do this. It's in the Windows environment.
Background: as part of an FTP process I have a batch file that grabs a file from an FTP site, puts it on our network, and appends the date to the name. This works when the filename is always going to be the same, but when the filename changes daily (the file that I'm grabbing), I can't find a way to append the date to it. I'm not really programming savvy, and here's what I currently use to append the date (only works however with a static name that never changes, in this instance I've used test.txt as the name I'm appending).
(Top line is just changing directories to where the file is located)
cd /D x:\public\data\external\aric\apps\
for /f "tokens=1-5 delims=/ " %%d in ("%date%") do rename "test.TXT" test_%%g-%%e-%%f.txt