Hello
I am trying to accomplish the following:
I automatically create some reports from a database every night. These Reports are copied to a Reports/YYYYMMDD-HH-MM Folder.
I would now like to use Macro Scheduler to copy the latest subfolder from the reports folder to another location.
Can anybody help me?
Regards
Magbert
Copy newest subfolder
Moderators: JRL, Dorian (MJT support)
You could try something like this. change the value of "sourcepath" and "destinationpath" to reflect your setup. Change RP_WINDOWMODE to 0 or 2 to avoid seeing the DOS window. to understand the dir and xcopy switches, open a DOS window and type dir /? or xcopy /?.
Hope this helps,
Dick
Hope this helps,
Dick
Code: Select all
Let>sourcepath=[drive]:\path\report
Let>destinationpath=[drive]:\path
Let>tempfile=%TEMP_DIR%~tempdirlist~.txt
Let>RP_WAIT=1
Let>RP_WINDOWMODE=1
Run>cmd /c dir %sourcepath% /b /o-d /ad > %tempfile%
ReadLn>%tempfile%,1,NewestDirectory
CreateDir>%destinationpath%\%NewestDirectory%
Run>cmd /c xcopy "%sourcepath%\%NewestDirectory%" "%destinationpath%"\%NewestDirectory% /e