Batch only copy new files

February 6, 2014 at 11:53:25
Specs: Server 2008

I would like help to batch the following

I have a folder with a subfolder per user. Every user has a folder called waiting and folder called approved. Approved has subfolders 01, 02, 03 to 10. I need a batch job copying only new files (since last batch copy) from the approved subfolders 01-10 to another destination folder with todays date. And furthermore I need the copied files renamed from filename.extension to subfoldername_filename.extension. eg. 01_customername.pdf.

Any help appreciated

Best regards,

See More: Batch only copy new files

Report •

February 6, 2014 at 15:04:35
The first half was clear enough, but the second half confuses me, so I've probably made a ton of mistakes, but here's this to try:
::======= begin batch
@echo off & setlocal
::first build date-string
for %%a in (%date%) do set d=%%a
set d=%d:/=%
set d=%d:-=%
for /d %%a in (*) do (
::following IF is not strictly necessary, but it may save time in larger directories.
if exist %%a\approved (
for %%b in (01 02 03 04 05 06 07 08 09 10) do (
for %%c in ("%%a\approved\%%b\*.*") do echo f|xcopy /M "%%c" \somewhere\%d%\%%b_%%~nxc
::====== end batch
I risked a dangerous assumption that the files have the archive-attribute set when generated. If this is not the case, then just ignore this whole thing :(

Report •

February 6, 2014 at 21:05:01
Post a few lines of the output of this bat.

::====== script starts here ===============
:: bons.bat 2014-02-07 12:02:19.03
@echo off > NEWFILE & setLocal enableDELAYedeXpansioN

for /f "tokens=* delims= " %%a in ('dir/b/od') do (
echo.%%~Ta %%a
::====== script ends here =================

M2 Golden-Triangle

Report •
Related Solutions

Ask Question