Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch commands on Win 2000 1

Status
Not open for further replies.

usedup

Programmer
Jun 25, 2003
4
US
I'm writing a batch file that makes a list of tiff names in a folder for use in a later conversion .bat file I wrote. However, I only need the first part of the file name to use as the variable (for example, in 100s1.tif, I only need 100s1 to make the file work).

Does anyone know of a dos command that will allow me to make the list from the folder using only the characters I need?
 
usedup,

Try this fragment:-

if exist tiflist.txt del tiflist.txt
for /f "tokens=1 delims=." %%a in ('dir *.tif /b') do @echo %%a >> tiflist.txt

Line2 does a bare dir listing of *.tif and then parses each line splitting it at the "." (delims=.) and returning the first part (tokens=1), then echoing into the file.

Ian

Everyday the Computer Gods pick one person to be "it". Maybe, today is your day !!
 
This was a big help - Thanks!!!
I knew there was a way to do it without complex coding and the used of a SED routine.
Because we're using a third party utility I figured we only needed a line command.

Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top