Re: Dos batch file to sort files based on file names.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I didn't know about the set types command.

This works fine.

Quick question what is the %%A do in the for statement. I know it is an
increament counter but how does it work? How does it know how many time to
run?

Thanks,
Jon



The approach you posted seems needlessly complex. I would think
something like this would get the job done ...

@echo off
set source=D:\Contents\Cherrypick_test
set target1=D:\contents\lost_and_found folder
set target2=D:\Contents\Cherrypick_test
:: List of file types
set types=Jonesboro;"Little Rock";Dallas;Houston;^
memphis;Authorized;General
:: Move matching files
for %%a in (%types%) do (
move "%source%\*%%~a*.m2t" "%target2%\%%~a")
:: Whatever's left move to lost and found
move "%source%\*.m2t" "%target1%"

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/



.