How to move only some file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
darioit
Posts: 230
Joined: 02 Aug 2010 05:25

How to move only some file

#1 Post by darioit » 09 Aug 2010 03:30

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

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: How to move only some file

#2 Post by aGerman » 09 Aug 2010 11:34

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

Post Reply