0555-DDBB/AirPhotos 0555-DDBB/AirPhotos/AP Labels 0555-DDBB/AirPhotos/new database 0555-DDBB/FOO M 0555-DDBB/FOO M/0555-055-01 Site/Photos 0555-DDBB/FOO M/0555-055-01 Site/Photos/Digital 0555-DDBB/FOO M/0555-055-01 Site/Photos/PhotoList 0555-DDBB/FOO M/0555-055-01 Site/Reports/Summary 0555-DDBB/FOO M/0555-055-01 Site/Reports/Daily 0555-DDBB/FOO M/0555-055-02 Design 0555-DDBB/FOO M/0555-055-02 Design/photo 0555-DDBB/FOO M/0555-055-02 Design/photo/Ortho 0555-DDBB/FOO M/0555-055-02 Design/Correspondance 0555-DDBB/FOO M/0555-055-02 Design/Drafting 0555-DDBB/FOO M/0555-055-02 Design/Drafting/DWGI would like to be able to print out a directory structure something like:
0555-DDBB
AirPhotos
AP Labels
new database
FOO M
0555-055-01 Site
Photos
Digital
PhotoList
Reports
Summary
Daily
0555-055-02 Design
photo
Ortho
Correspondance
Drafting
DWG
Basically remove the duplication, and some indenting to show levels ofr the directory tree.
But I'm having trouble thinking of a way to store it so I can print it out. I played with some nested hashes, but it seemed to get ugly after I had 6 or 7 levels of directories to sort ($paths{$dir1}{$subdir1} $paths{$dir1}{$subdir2} etc etc). I have each directory in an array and I can split on '/', but from there I'm lost.
How can I store all the info (direcotry names and location) and then print out as above? I'm just stuck for an idea - can anyone stear me in the right direction? Thanks,@dirs = ( # list from above ); foreach my $dir (@dirs) { my @singleDirs = split(/\//, $dir); # stuck }
In reply to organizing directory path data by djw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |