For /f find

Microsoft Windows 7 home premium
August 18, 2010 at 12:43:24
Specs: Any, 2g
i have a file with about 100 lines with ful directorys and file names.

example----
----------------
c:\blah\nope.txt
c:\blah\blah2\file.txt
c:\blah\blah2\whoaaa\mmk\notherfile.txt
------------------------

in my for loop, I'm basically trying to get the file name itself and output it to a log file.

I've been trying for awile touse for/ to do it but i cant seem to get my tokens/delims right.

im thinking i need to use for to find the last / on the line and get whatever is to the right of it.

any suggestions?

Thanks

Adam


See More: For /f find

Report •

#1
August 18, 2010 at 12:54:12
Is this what you need:

FOR /f "tokens=*" %%i in ('dir /b /s *.*') do (
ECHO %%i >> spreadsheet.txt )

MIKE

http://www.skeptic.com/


Report •

#2
August 18, 2010 at 18:11:17
Well, maybe I'm misunderstanding you, but here's what I tihnk you want.

You want to find a word within any file, and output the names of those file to the screen?

@ECHO OFF
SETLOCAL EnableDelayedExpansion

CD "P:\arent\Directory\"

FOR /f "tokens=*" %%a IN ('FINDSTR /i /m /s "STRING" *.txt') DO (
	ECHO %%a
)

ECHO Press any key to exit . . .
PAUSE>Nul
EXIT


Report •
Related Solutions


Ask Question