T
Tom Sibley
I have the following script:
dir \\server\share\_* > Names.Txt
for /f "Skip=5 Tokens=4 Delims= " %%a in (Names.Txt) do md %%a
for /f "eol= Tokens=4,5 Delims=_,- " %%a in (Names.Txt) do (if exist
_%%a-%%b ren _%%a-%%b _%%a_%%b)
"Names.Txt"
01/08/2004 12:40p <DIR> _User-1
02/06/2004 12:42p <DIR> _User-2
0 File(s) 0 bytes
65 Dir(s) 51,539,935,232 bytes free
Line 01 Runs a directory of the server share and looks for folders with "_*"
and ports it to "Names.Txt"
Line 02 Reads the "Names.Txt" file and "md" makes a directory in the new
location
Line 03 Reads the "Names.Txt" to for variable fill in, then checks that the
folder exist and renames it from _User-1 to _User_1 etc.
Beacuse of the directory command "Bytes" is listed in Tokens=4 area and gets
created as a Folder
How do I end the read process before it gets to the "0 File(s) (0)bytes"
line?
dir \\server\share\_* > Names.Txt
for /f "Skip=5 Tokens=4 Delims= " %%a in (Names.Txt) do md %%a
for /f "eol= Tokens=4,5 Delims=_,- " %%a in (Names.Txt) do (if exist
_%%a-%%b ren _%%a-%%b _%%a_%%b)
"Names.Txt"
01/08/2004 12:40p <DIR> _User-1
02/06/2004 12:42p <DIR> _User-2
0 File(s) 0 bytes
65 Dir(s) 51,539,935,232 bytes free
Line 01 Runs a directory of the server share and looks for folders with "_*"
and ports it to "Names.Txt"
Line 02 Reads the "Names.Txt" file and "md" makes a directory in the new
location
Line 03 Reads the "Names.Txt" to for variable fill in, then checks that the
folder exist and renames it from _User-1 to _User_1 etc.
Beacuse of the directory command "Bytes" is listed in Tokens=4 area and gets
created as a Folder
How do I end the read process before it gets to the "0 File(s) (0)bytes"
line?