Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I try to find a way to make an archive of my ~/ directory so that I can go back in case I've lost something. I've found several recommendations for this. The first being OS X Hints saying a simple ls -aR or re-writing a tree.
The problem these two solutions have is that the output doesn't help very much in terms of getting an overview where something was.

Is there anything that is able to produce a visual representation of a directory structure that allows to see what contents were in which directory? A Terminal command? A SVG generator?

EDIT: No GUI tools for the generation of the file please. Viewing the large outputs of find ~/ and ls ~/ is cumbersome. Or is it possible to make it easier to view a 70MB text file?

EDIT2: I should probably clarify what I'm trying to do. I recently had my hard disk crash. Fortunately I had an off-site and on-site backup. In the restore however I chose to set the machine up from scratch, which means I had to very specifically pick what to restore from where.
Now that I'm done with that, I'm investigating whether it's possible to save the directory structure in certain periods of time in my backup, so that restoring becomes a bit easier. (In case I ever lose a couple days of work, with two different backups at two different stages.)

Thanks in advance, Zettt

share|improve this question
    
ls -aR and tree only list the directory structure and do NOT archive - what exactly do you mean - the usual archive tools would include Time Machine, rsync, tar –  Mark Aug 7 '12 at 10:53
    
A collection of the data I had, not the data itself. As you see in the references links, I'm not looking for a backup. –  Zettt Aug 7 '12 at 14:10
    
Well, what do you want now? It's either a GUI or browsing a huge text file, you can't have both. And text file browsing is rather easy with either TextEdit.app or less/vi/emacs –  patrix Aug 7 '12 at 20:13

3 Answers 3

  1. Get TextWrangler. It’s free and awesome.
  2. Drag (e.g. your home) folder into Text window: How to drag
  3. Profit!
share|improve this answer
    
I've edited my original post. Thanks for the help. Much appreciated. –  Zettt Aug 7 '12 at 20:11

find . gives a listing of all the folders/files starting from the current directory:

pse@Fourecks:/etc/apache2$ find .
.
./extra
./extra/httpd-autoindex.conf
./extra/httpd-dav.conf
./extra/httpd-default.conf
./httpd.conf
./httpd.conf~previous
./magic
./other
./other/php5.conf
./users
./users/pse.conf
share|improve this answer
    
find is mentioned in my original post. (in the link on rewriting tree). Anyway, the large text files find or ls produce are so huge that it's hard to get an overview after restoring from a backup where something was. –  Zettt Aug 7 '12 at 20:13
    
grep something huge-file-list solves that quite nicely –  patrix Aug 7 '12 at 20:14
    
That would be very slow. –  Zettt Aug 7 '12 at 21:48
    
Did you try? Even on large directories listings, grep is extremely fast –  patrix Aug 8 '12 at 3:23
    
Just for the record: Running grep to search for the last line in a 100'000 lines text took about 0.1 sec on my iMac. –  patrix Aug 9 '12 at 17:35

I found something that works quite reliably. (The applications mentioned in this post are actually links)

tdu is a "visualizer" for the du command. Together with dugroup (same software package) it's quite useful.

In my scenario I would run du $HOME > "$HOME/History/$(date "+%Y-%m-%d %H-%M") Home History.txt".
Then by running cat 2012-08-07 20-00 Home History.txt | dugroup | tdu the file structure would be viewable "offline". I've tried ncdu, but it has a bug where it deletes all files the program was started in when given a du output file.

Thanks for all the help. I really appreciate it.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.