This codes are moving the files from source folder to destination perfectly.
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%"
for /l %%a in (0) do (
if exist "C:\test\1*%datestamp%.*" move "C:\test\1*%datestamp%.*" "D:\report"
if exist "C:\test\TR%datestamp%.*" move "C:\test\TR%datestamp%.*" "D:\report"
ping -n 60 localhost > nul
But now i want this codes to search recursively in multiple sub-folders. The folder structure is in this format.
C:\Repository\000\todays date(dd-mm-yyyy)\upload\file1 and file2
C:\Repository\001\todays date(dd-mm-yyyy)\upload\file1 and file2
C:\Repository\002\todays date(dd-mm-yyyy)\upload\file1 and file2
To move the files from this sub folder upload to D:\report search for files every 60 seconds.
The first file will never be in duplicate so no issue of overwriting the file in destination folder, but the second file can be duplicate so how to overcome that issue. can we create a merge file in destination folder. They are text files.
The description of file name 1.
For files type 1 it will not have duplicates why all the upload folders will deliver different names files.
1*ddmm.txt means 1 is type of report and its compulsory
----------- next is * means first 3 character of file name which can be VAT,RPT,SLR,STT, ....
----------- and day&month.
1VAT0701.txt, 1RPT0701.txt, 1SLR0701.txt
File type 2 will be dupicated that means from every upload this file TR(means transaction) files will be delivered in upload folder.
TRddmm.txt means TR common tag and next is day&month
message edited by Danny01