Perl: the Markov chain saw | |
PerlMonks |
How do I get the directory containing a given file?by mobiGeek (Beadle) |
on Feb 24, 2002 at 18:25 UTC ( [id://147189]=perlquestion: print w/replies, xml ) | Need Help?? |
mobiGeek has asked for the wisdom of the Perl Monks concerning the following question:
Seems simple enough, but what is the best platform-independent way to get the directory for a given file path? I want a simple program that is given a list of files (say, output from "find") and for each file, prints the containing directory. For example: $ pwd /home/mobiGeek $ perl dirs.pl ../foo.html /etc/passwd /a/b/c/smile.gif /home /etc /a/b/cThanks in advance, mobiGeek.
Back to
Seekers of Perl Wisdom
|
|