How can I only have a single move command in a batch file?

Posted by PeanutsMonkey on Super User See other posts from Super User or by PeanutsMonkey
Published on 2012-08-28T02:45:36Z Indexed on 2012/08/28 3:40 UTC
Read the original article Hit count: 453

Filed under:
|

I have an existing batch file that attempts to move files from 2 directories to 2 different locations. At the moment these are called as 2 separate move commands. I am wanting to simply the code further and was wondering if there was a way to do so

@echo off
for %%a in (C:\Test\*.*) do if "%%~xa" == "" move /Y "C:\Test\%%~na%%~xa" "D:\Done" 
for %%i in (C:\Sample\*.*) do if "%%~xi" == "" move /Y "C:\Sample\%%~ni%%~xi" "D:\Done"

© Super User or respective owner

Related posts about Windows

Related posts about batch-file