I am trying to replace a single line of code
`rm -rf $tmp/scale-*` with something that is portable across OSes. My first idea was
File::Path::remove_tree($tmp,{keep_root=>1}), but I don't want to necessarily remove everything in the
$tmp directory. Those scale-* directories have filled subdirectories too, hence the -f in the rm call. I'm also trying to not construct the paths directly, I've used
File::Spec->catfile() in other places in this script. I'm trying to stick with core Perl modules, since I don't want users to have to install anything separately if possible. What I thought would work was some combination of
File::Path::remove_tree,
glob(), and
File::Spec->catfile() (or similar), but I can't seem to put it all together. Most of the
glob() examples I've seen have hard-coded directories. Please tell me I'm over-thinking this!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.