However this failed because some already existed and gives a fail.
So I switched to xcopy and created a .bat that I ran from Amibroker batch execute and wait.
xcopy "C:\Source\" "C:\Destination\" /d /s /y
However this will to not work if file is open, so I created another .bat file with Robocopy and ran the .bat file with Amibroker Batch execute and wait.
robocopy "C:\Source" "D:\Destination" /XO /XC
and this seems to work, but my question is, might there be a better way to do this?
I am not exactly sure what is your intention of copying only new file.
I assume all files in Source folder as backup and the latest files in Destination folder for processing.
During the creation of each files in Source folder, duplicate a copy of standard name in Destination folder. In this case, Destination folder will always have the latest files as the old ones get replaced during each file creation cycle.
This is just an example.
20240909_abc.txt
20240910_abc.txt
You can AFL string function to determine which file is the latest.
FDIR returns a comma separated string.
Use Strextract and check each date in the file name. AFL Function Reference - STREXTRACT (amibroker.com)
ok thanks, they are not currently named this way, but that is a possibility, thanks, but I think the robocopy will work, just know there are a lot smarter minds out here than mine so I wanted to see what suggestions there were.