I am new to the batch file process and I followed this post to create a script that copies my most recent file.
How to code a batch file to copy and rename the most recently dated file?
@echo off
setLocal DisableDelayedExpansion
pushd H:\
setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%G in ('dir/b/od') do (set newest=%%G)
copy %newest% H:\archive\testFile.txt
POPD
I tested with a small file successfully but when I moved to production I received this error:The system cannot find the file specified.
Is there any limitation on file size with this script? The size difference is 1kb for test and 6.5mb for prod. Apart from internal content of the test file, this is the only difference I can think of.
('dir/b/od')
to('dir/b/od/a-d')
? – npocmaka