in reply to Re^5: Directory Tree Structure
in thread Directory Tree Structure

graff,

What is the line @ARGV == 1 and -d $ARGV[0] or die "Usage: $0 path_name\n"; doing? I plug in my $rootdir but the script dies at that point. I can't figure out what is wrong until I know what that is doing. Only after I get this working can I start adding all of the sort rules that will be needed (if I can figure out where those should go).

Have a nice day!
Lady Aleena

Replies are listed 'Best First'.
Re^7: Directory Tree Structure
by graff (Chancellor) on Oct 19, 2009 at 22:14 UTC
    Sorry... I changed the "user interface" on the script without telling you. The version you originally posted had a specific path hard-coded for "$rootdir", but in order for me to try it out myself (without a windows system or the specific directory path you used), I made it so that the "$rootdir" comes from a command-line argument (given to the script via @ARGV).

    So my version requires exactly one command-line arg (@ARGV==1) and this arg must represent a reachable directory path (-d $ARGV[0]), or else the script dies and tells you what it needs in order to run (Usage: {name_of_script} path_name). That's just a typical unix-style CLI.

    To go back to your own hard-coded value for $rootdir, just comment out that @ARGV line and the one after it, then add in your single line that assigns a specific path string to $rootdir.