Page 1 of 1

How to move only some file

Posted: 09 Aug 2010 03:30
by darioit
Hello,
I wanna move some file that the name is not "*.new" and I wrote this script

Code: Select all

Dir /b C:\input\* > C:\a\list.txt
For /F %%i in ('findstr /v "new" C:\a\list.txt') do move C:\input\%%i C:\output


There's some other elegant method to do the same?
Thanks in advance

Re: How to move only some file

Posted: 09 Aug 2010 11:34
by aGerman
You could process the DIR command directly.

Code: Select all

for /f "delims=" %%i in ('dir /a-d /b C:\input\*.*') do (
  if "%%~xi" neq ".new" move C:\input\%%i C:\output
)


Regards
aGerman