Recursive ls with full path
I have been doing some housekeeping - archiving video and audio files to DVD. As I will never be able to remember what is on what DVD I am creating a catalog of files - a text file which I can search and find which DVD contains a certain video for example. I have been doing this for years using Windoze and the dir command. Even after using Linux for many years I would mount the DVDs from a Win XP virtual machine to read the file list and concatenate it to my list. I finally decided it is time to do this from Linux directly. Here is an example of what I am after
Quote:
Quote:
ls -r -1 ls -r -1 /**/* I am able to display the files and full path at but not at all levels. For example Quote:
TIA, Ken |
Hey there :) Have you ever tried "tree" command in Linux? It has more simple syntax than ls itself and will output each level of a directory.
Give it a try. |
Thanks fuorviato!
I had used the tree command in Windoze. I had not tried it in Linux. Seems it is not there by default. I have installed the package and played with it a little. It produces a fancier output than I had used previosly. I will substitute it in my DVD cataloging script and see how it works out. Thanks again, Ken |
OK. Feel free to write in case of problems, so maybe we can help around :)
|
"tree" works very well
i use it all the time the basic just typing Code:
tree have a look at the help page Code:
tree --help |
Quote:
Ah. If the trick works for you, mark the thread as "solved" pls. |
Again my sincere thanks fuorviato,
I incorporated tree into my directory reading script thus Code:
df | grep /dev/sr0 | grep /media | awk '{print$ 6}' | sed s/"\/media\/"// >> dvd.list Quote:
You have provided me with the answer to my original question and I will mark this thread as solved! Thanks once more, Ken p.s. The way I use this script is as follows: 1 - insert a DVD 2 - allow the DVD to auto mount 3 - run the script (as root because of mount/umount) 4 - pick up the ejected DVD and repeat - all rather efficient I think I can improve it by parsing the label of the DVD to a variable and substituting it into the tree command. That would eliminate the redundant mount and allow me to run the script as a normal user. That is on my todo list. |
My new and improved script - even simpler
Code:
#!/bin/bash Quote:
|
What about just
Code:
me@lappy:~/Desktop$ find edit: probably not what you want, but it also answers the OP for future searchers who may. |
Thanks descendant_command,
I have played with find a bit. I appreciate your adding to the thread for completeness and future reference. Ken |
All times are GMT -5. The time now is 11:21 AM. |