Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
Distribution: Ubuntu 05.10, 6.06 also have used: FC 3, 4 & 5
Posts: 15
Rep:
Re: find -name and moving to file
Quote:
Originally posted by mijohnst 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:
I've had no luck. What am I doing wrong? Sorry, I know this is a basic tool...
If you are just trying to get the list of files into another file, why are you wasting your time with the find command?
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.