There is a huge amount of pdf files in my datacenter's subdirectories. In a local folder i want to check if the existing files are already in the datacenter's dir and if yes to move them to another local folder. I want to filter my search to .pdf files that have been modified today, otherwise the whole search thing in datacenter's subdirs takes ages.
@echo off
pushD \\server\pdf
for /r %%i in ( *.pdf ) do (
if exist "%userprofile%\desktop\F1\%%~nxi" ( move /y "%userprofile%\desktop\F1\%%~nxi" %userprofile%\desktop\F3
) else echo File %%~nxi is not a duplicate
)
popD
pause
What should i add to above for command ?
You already know about the
ForFiles
command, mentioning it in your duplicate question on DosTips; so why not use it?If you prefer you could use
Move
with the/Y
option or you could forget about theIf Exist
and just supress error messages, but the general idea should work for you.