We need a tool to perform copying folders and files.
There are two requests:
1) Define Date: only copy Folder and Files are created after defining date. So we use XCOPY /D: mm-dd-yyyy
2) Filter out certain file types and folders. So we can use XCOPY /Exclude: filter.txt (filter.txt define filter list).
we use XCopy command to create a batch (~.bat) file.
It seems that XCopy works either with filter on date (/D: mm-dd-yyyy) or filter on file type (/Exclude: filter.txt) and NOT work for both together.
when XCopy sourcepath destinationpath /D: 11-1-2021 and /Exclude: filter.txt, it only works for filtering file types.
Defined date does not apply. It also copies folders and files which are created before "11-1-2021".
XCOPY /S /I /E /D:11-01-2021 /EXCLUDE:get_instrument_files_omit.txt "Instrument Runs\" "xxx\Instrument Runs"
Could we perform XCOPY and by applying both date and files filter together?
we also try XCOPY with following two steps:
1) first filter files and folder which includes a huge data and copy folders and files into "TempRuns" folder.
2) second apply date filter in "TempRuns" and copying to destination folder.
set TEMPRUNSFOLDER="TempRuns" XCOPY /S /I /E "Instrument Runs*.*" %TEMPRUNSFOLDER% /EXCLUDE:get_instrument_files_omit.txt XCOPY /S /I /E /D:11-01-2021 %TEMPRUNSFOLDER% "xxx\Instrument Runs"
the problem with first step: during first XCOPY copying, all folder are create with date which is today.
so second copy with date filter does not work and it copies all folders and files under "TempRuns" folder.
Is it possible that when first XCOPY to TempRuns folder and keep all created folders as original date?
if not, do we have other choice?
we just need a simple tool. Thx!