I'm trying to copy the latest file in one network location to another network location and rename the file. The source path is \test\BI\reports\2023 The destination path is \PM\test\reports the destination file name is BI-1234_wPC.xls
I used the code from ashipfl in the following thread text.
pushd "\\fipr01\SNAP"
for /F "delims=" %%F in ('
dir /B /O:D /T:C "*.tmp"
') do (
set "NEWEST=%%F"
)
copy /Y "%NEWEST%" "C:\Users\ddtacopy\Desktop\AutoCopy\SNAP.txt"
popd
The expected outcome should be \PM\test\reports\BI-1234_wPC.xls
Unfortunately, the file is not being copied at all. Any help will be appreciated.