| Welcome to WebmasterWorld Guest from 188.8.131.52 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Become a Pro Member|
|Using "ls" to list all html files recursively...|
How to please ;-)
I have a directory with many sub-dirs.
I would like to ls all files ending in .html recursively.
$> ls -R /path/to/dir/*.html
but it only lists from the parent dir not recursively through all the sub-dirs....
Any clues greatly appreciated ;)
Also I'd like to count these files...
I havenít used UNIX for a while, but I believe I used the find command for that type of task.
There might be a cleaner way but this will work from the directory you want to recursively search in.
find . -name "*.html" ¶ grep -c .
If you want a list of them you could do something like this:
find . -name "*.html" > temp.txt
What's the .-name bit?
I'm just getting a bunch of errors?
-name is telling find to look for files with that string in the name.
Make sure you have a space between the "." and -name.
Great, got it. thanks very much ;)
Didnt get ¦ grep -c to work though, I output it and then got a line count in vim...
¶ grep -c
¶ grep -c .
with the trailing dot.
¦ wc -l
would do the same thing
My eyes arn't the best ;)
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved