|
Author |
Message |
Joined: Apr 16, 2009 Posts: 7
Location:Beijing,China
Other Topics
|
Posted May 03, 2009 at 4:34:55 AM
Subject: How to scan a directory and store the info to the disk?
How to scan a directory (such as /usr/bin)and store the info to the disk? what kinds of function should be used? thanks.
|
Rubberman
Joined Jul 30, 2007 Posts: 944
Location:40 miles west of Chicago
Other Topics
|
Posted:
May 04, 2009 8:14:49 PM
Subject: How to scan a directory and store the info to the disk?
Just pipe the output to a file. IE: "ls dirname >filename". If you want to get all the sub-directories as well, then use "ls -R dirname >filename"
Sometimes real fast is almost as good as real time.
Remember, Google is your friend!
|
Ralph
Joined May 11, 2009 Posts: 1
Location:Co. Kerry, Ireland
Other Topics
|
Posted:
May 11, 2009 4:25:19 PM
Subject: How to scan a directory and store the info to the disk?
If you are scanning a directory that has subdirectories as well the recursive version of ls is not of much help as it does not output the full pathname.
But you could use find instead.
find yourdirectoryhere > filenames
And as a real treat, you can filter filenames according to various conditions:
find yourdirectoryhere -newer lastscan > newfilenames
find yourdirectoryhere -size 4M > bigfilenames
The options are endless. Have fun.
[Modified by: Ralph on May 11, 2009 04:28 PM]
Linux Solutions for Professionals - http://linuxcoaching.eu
|