Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 08-03-2010, 02:54 PM   #1
LQ Newbie
Registered: Apr 2010
Posts: 4

Rep: Reputation: 0
Script to list content of Hard Drives


Does anyone know of a script / program that will give me a listing of all the content on my hard drive(s)? I have two drives that I keep my content on (which is re-downloadable if I lose a drive). In the event that I lose a drive, I would like to have a list that I can refer to so I know what I need to re-download again.

It would be good if it doesn't list *every* file but maybe only the relevant folders and files. For example, many folders are extracted archives of 100's of files. If it just gave me the folder name that would be better than all the files (less stuff to sift through).

Does anyone know anything like this? I apologize if this sounds kind of vague but I figured I would ask the experts while I pound away at a few scripts (which I suck at)

Old 08-03-2010, 03:45 PM   #2
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
The find command will probably answer your need but you are going to have to be precise about defining "relevant folders and files".
Old 08-03-2010, 03:56 PM   #3
LQ Newbie
Registered: Jun 2008
Distribution: FC6
Posts: 2
Blog Entries: 1

Rep: Reputation: 0
You could try 'find':
Short usage: find dir1 [dir2] [options]

Example, find all files in ${HOME}/rje and ${HOME}/Downloads,
and print the list:
find ${HOME}/rje ${HOME}/Downloads -type f -print

You can re-direct that to a file:
find dir -type f -print > ${HOME}/filelist
Then you could compare with an old file list:
cd ${HOME}
if ! cmp -s filelist old.filelist
# files different, do something, then save the filelist
cp filelist old.filelist
Old 08-03-2010, 04:08 PM   #4
LQ Newbie
Registered: Nov 2004
Distribution: OpenSUSE 11.3 64bit Intel Core2 Quad Core Q9300, 4GBRAM
Posts: 9

Rep: Reputation: 0
to list only directories, use:
> find dir -type d



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
mounted drives content deletion kais1 Linux - Newbie 3 06-09-2009 09:32 PM
Is there a list of a system's installed hard drives? ojaiguy Linux - Hardware 20 06-16-2008 01:15 PM
Shell Script to detect USB hard drives kushalkoolwal Programming 4 05-27-2008 01:41 PM
Script to put hard drives to sleep when no IO hamstar Programming 5 12-18-2007 10:23 PM
How can I get konqueror's media:/ to list hard drives by label instead of size? DaneM Linux - Software 1 06-03-2006 02:57 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:39 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration