Utility Needed - list folder tree and files in text file
Linux - SoftwareThis 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
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.
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.
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.
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/-/|/'
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.
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.
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 ...
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.