How to scan a directory and store the info to the disk?
Author Message
Posted : Sun, 03 May 2009 04:34:55
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
Posted : Mon, 04 May 2009 20:14:49
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"
Ralph
Posted : Mon, 11 May 2009 16:25:19
Subject : Re: 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]