[<<]Message[>>]    [<<]Author[>>]    [<<]Subject        [<<]Thread    

Number : 7126 Date : 2004-02-01 Author : Garry Deane Subject : Re: Filename macro handling Size(KB) : 0
--- In xxcopy@yahoogroups.com, Michael Marquart wrote: > @echo off > for /f "tokens=1,2* delims=-" %%a in ('dir \????-*.* /b') do ( > echo move "%%a-%%b" "%%a" > ) > > Remove the echo when you're happy it's doing what you want. > Requires NT. Since there are about 10,000 files, the FOR /F command (being memory limited) will probably fail after a few thousand files. This is not a big deal because the batch can be re-run with each run grabbing another few thousand files until all the files are moved. Here's a lightly different version which should avoid any memory constraints (a plain FOR without the /F isn't memory sensitive): @echo off setlocal for %%a in (????-*) do call :move %%a goto :eof :move if not exist %1 goto :eof set head=%1 set head=%head:~0,4% echo moving %head%-* files md %head% move %head%-* %head% goto :eof Garry
This message if part of XXCOPY's message Archive. The archive contains all the messages posted at Yahoo!Groups: XXCOPY.