find -name and moving to file
I'm trying to do something that I know worked before, but I must have forgotten a step or something.
I want to search some directories for specific file and output it to a file as a list. I thought it would be something like this: find . -name *.tmp -print >> /tmp/list.txt When I type this it prints a list of the files it finds on the screen, but nothing in the file I'm redirecting to. I've even tried: find . -name *.tmp | printf "%s/n" >>/tmp/list.txt I've had no luck. What am I doing wrong? Sorry, I know this is a basic tool... |
-name ?
find ./ -name temp* >> /tmp/listit
just worked for me. Your example doesn't include the "-name" option, but i'm guessing it's a typo because your subject does. If that doesn't work, try escaping the star since it's at the front of the search string. |
Opps... yeah, I have been using -name and it still didn't work.
The strange thing about it is that when I leave off the print command, it just prints each file down the screen... I just cannot get it to copy into a file. |
hey zedmelon... your suggestion worked. It will list the files if I do a:
find ./ -name temp* >> /tmp/list.txt Makes me wonder how you'd do a find on files with a certain extension though. |
Re: find -name and moving to file
Quote:
Use list: ls -l *.tmp >> /tmp/list.txt I also do something that may not be required with the find command. I use single quotes around the search string: '*.tmp', nonetheless if you just need the list use the list command. It's both simple and quick. Hope I have not misread your intent. |
Thanks txtedmacs! That works too... lol
If it sounds to easy, it's because it is. :) |
All times are GMT -5. The time now is 09:58 PM. |