LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices



Reply
 
Search this Thread
Old 11-15-2006, 10:03 AM   #1
Optiker
Member
 
Registered: Nov 2005
Distribution: Mint 14 Nadia
Posts: 189

Rep: Reputation: 21
Utility Needed - list folder tree and files in text file


In Windows, I have a utility that generates a text list of the folder tree and/or files. Is there a Linux eqwuivalent?

If so, I need it for a system dual booted with Kubuntu (maybe Breezy, but also maybe Hoary) and Win2000Pro, where the Win2000 installation is broken and I'd like to examine the contents of various folders on the Windows C-drive.

At present, the Kubuntu installation isn't connecting to the net, so will have to do a manual install from files DLed on another computer and transferred via thumbdrive.

Finding it is just the first step! I've never installed manually from scratch, so preference would be for a utility that is simplest to install if there are more than one available.

Thanks!
Optiker
 
Old 11-15-2006, 10:23 AM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

Rep: Reputation: 68
ls -R
?

Also try
ls -R >filename
 
Old 11-15-2006, 10:28 AM   #3
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Quote:
Originally Posted by raskin
ls -R
?

Also try
ls -R >filename
Eww.. ls -R output is nasty, use tree instead.

And if you want to put the list into a file:

tree > filename
 
Old 11-15-2006, 11:08 AM   #4
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,032

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
Quote:
Originally Posted by Optiker
In Windows, I have a utility that generates a text list of the folder tree and/or files. Is there a Linux eqwuivalent?
Are you looking for a graphical thingy, or just plain text output?

If it's the latter, you can run find /path/to/directory -print

I'm not familiar with graphical tools to do this, although I'm sure they must exist. I'm thinking you're wanting something like the pstree command for processes, except you want it for files/directories.
 
Old 11-15-2006, 11:41 AM   #5
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Quote:
Originally Posted by haertig
I'm thinking you're wanting something like the pstree command for processes, except you want it for files/directories.
You mean like tree which I already pointed out?
 
Old 11-15-2006, 12:04 PM   #6
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,032

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
Quote:
Originally Posted by trickykid
You mean like tree which I already pointed out?
Probably, because the name of the command implies it would do what the O.P. wants. But I can't say for sure, since I don't have that command on my system. I seem to remember a "tree", or "dirtree", or "dtree" command from way back ... I think from MSDOS, not from Linux/Unix. "tree" is not available on any of the Linux or Solaris boxes I normally work with.

Or, you could always do it the obvious way ...
Code:
ls -R .* | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/   /' -e 's/-/|/'

Last edited by haertig; 11-15-2006 at 12:07 PM.
 
Old 11-15-2006, 12:21 PM   #7
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
tree can be found here: ftp://mama.indstate.edu/linux/tree/

Comes default on Slackware installs as that's what it's packaged as but just downloading the binary file they have and placing in /usr/bin or somewhere in your path works with no problems, just tested on a Centos host, just have to make it executable. I remember older versions of Redhat and such also had it as an option, but most don't nowadays.

Last edited by trickykid; 11-15-2006 at 12:30 PM.
 
Old 11-15-2006, 04:31 PM   #8
Optiker
Member
 
Registered: Nov 2005
Distribution: Mint 14 Nadia
Posts: 189

Original Poster
Rep: Reputation: 21
Hmmm...I'm not very experienced with Linux. Let me put it simply. I want some way to save to a text file, a list of all folders, subfolders and files within those folders. The only examples I can give are from Windows. These might be stand-alone utilities, or possibly what you might call extensions that integrate into Windows Explorer and appear in the drop-down menues when a folder is right-clicked. A nice file output is csv that can then be opened in a speadsheet and parsed to make it more organized, but a simple listing, one line for each file and/or folder, showing its patch is adequate.

As a not-very-skilled Linux user, I'm guessing that the replies so far are suggesting console commands. That's OK if necesary, but a GUI utility would obviously be more intuitive and thus easier for a novice like me.

Given all of that, thanks for the replies. I'll try to make some sense of them when I get home tonight in front of my Kubuntu system.

Optiker
 
Old 11-15-2006, 04:58 PM   #9
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

Rep: Reputation: 68
Hmm.. What you say is more like
find >filename
.

About GUI - I am not sure that there exists GUI for one shell line.
 
Old 11-15-2006, 05:16 PM   #10
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,032

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
Quote:
Originally Posted by Optiker
A nice file output is csv that can then be opened in a speadsheet
Not sure if this is what you want. For one, it's command line, not GUI. But it will create a CSV file for you.
Code:
$ cd /to/the/directory/that/you/want
$ find | sed -e's/"/\\"/g' -e's/^..//' -e's/\//","/g' -e's/^/"/' -e's/$/"/' > /tmp/listing.csv
You CSV file will be saved in /tmp/listing.csv in this example. You can open the CSV file with Microsoft Excel if that's what you want. Or OpenOffice Calc, or Gnome's Gnumeric, or ...
 
Old 11-15-2006, 05:54 PM   #11
Optiker
Member
 
Registered: Nov 2005
Distribution: Mint 14 Nadia
Posts: 189

Original Poster
Rep: Reputation: 21
Quote:
Originally Posted by haertig
Not sure if this is what you want. For one, it's command line, not GUI. But it will create a CSV file for you.
Code:
$ cd /to/the/directory/that/you/want
$ find | sed -e's/"/\\"/g' -e's/^..//' -e's/\//","/g' -e's/^/"/' -e's/$/"/' > /tmp/listing.csv
You CSV file will be saved in /tmp/listing.csv in this example. You can open the CSV file with Microsoft Excel if that's what you want. Or OpenOffice Calc, or Gnome's Gnumeric, or ...
haertig...OK, as intimidating and incomprehensible as it is, since I can just copy and paste, I'll try it. Indeed, the output that you describe sounds like what I'm after.

Will try it tonight and report back then.

Thanks all!
 
Old 11-15-2006, 05:57 PM   #12
Optiker
Member
 
Registered: Nov 2005
Distribution: Mint 14 Nadia
Posts: 189

Original Poster
Rep: Reputation: 21
haertig...BTW, does this do just the directory, or does it also include all subdirectories? I need to get a fairly complete listing of my Windows C-drive - at a minimnum, the root and Windows directories and the subdirectories of the Windows directory.

Thanks again!
Optiker
 
Old 11-15-2006, 07:31 PM   #13
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,032

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
Quote:
Originally Posted by Optiker
does it also include all subdirectories?
Yes, it should list everything. All subdirectories and files.
Quote:
I need to get a fairly complete listing of my Windows C-drive
That will take a while. I would expect over 100,000 files and directories for even a modest Windows installation! If you have user directories there ("Documents and Settings") then it could get quite a bit larger. Especially if you have lots of games installed. You could end up with a CSV file that exceeds the number of rows a spreadsheet program can handle. Can these programs digest a quarter million rows in one bite???!!! Never tried that myself. You theoretically could end up with that many.
 
Old 11-15-2006, 11:24 PM   #14
Optiker
Member
 
Registered: Nov 2005
Distribution: Mint 14 Nadia
Posts: 189

Original Poster
Rep: Reputation: 21
Quote:
Originally Posted by haertig
Code:
$ find | sed -e's/"/\\"/g' -e's/^..//' -e's/\//","/g' -e's/^/"/' -e's/$/"/' > /tmp/listing.csv
OK - tried it...

bash: $: command not found

Fresh install of Kubuntu Edgy.

Suggestions?

Optiker
 
Old 11-16-2006, 12:38 AM   #15
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,032

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
Quote:
bash: $: command not found
You don't type that dollar sign. That's supposed to represent your command prompt (i.e., what the computer displays to you indicating it's waiting for your input). Your prompt is probably not a simple dollar sign. That's a generic representation for a normal user's prompt, since they vary from distribution to distribution, and from person to person (personal preference). A pound sign ( # ) is the generic representation for the superuser prompt ... what you see when you're logged in as root.
 
  


Reply


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
How do I replace text with perl with a list fo files? nadavvin Programming 7 09-14-2006 08:12 PM
Find 100 largest files in folder tree tyreth Linux - General 2 02-07-2006 09:18 AM
Command to select and move mutiple files from list in text file steve.paris Linux - Newbie 11 11-27-2005 01:44 PM
How to find a work within a folder full of text files? juanb Linux - General 4 05-03-2005 05:09 PM
Display a list of files in a folder in apache Snorideguy Linux - Software 4 02-26-2004 02:05 PM


All times are GMT -5. The time now is 03:01 AM.

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