robocopy - do not copy source uncompressed file when zip file of same name present in destination directory -
i have batch file uses robocopy copy data files 1 location another. because of capacity problems on destination drive, have created script makes zip files of each individual data file , removed original data file system.
how can modify batch file copies new '.dat' files destination when there isn't matching '.zip' file same file name? require new '.dat' files on destination drive processing before conversion '.zip'
here's example of source , destination files:
sourcedir\file1.dat sourcedir\file2.dat sourcedir\file3.dat sourcedir\file4.dat sourcedir\file5.dat sourcedir\subdir1\file1.dat sourcedir\subdir1\file2.dat sourcedir\subdir3\file22.dat destdir\file2.zip destdir\file3.zip destdir\file5.zip destdir\subdir1\file1.zip
only
sourcedir\file1.dat sourcedir\file4.dat sourcedir\subdir1\file2.dat sourcedir\subdir3\file22.dat
should copied destdir
thanks!
erik
the current robocopy script has following format:
robocopy sourcedir destdir *.dat /s /copy:da /xo /maxage:200
loop through files , copy them individually if don't exist:
for %%f in (%sourcedir%\*.dat) ( if not exist %destdir%\%%~nf.zip ( // something... ) )
Comments
Post a Comment