in reply to Accessing a folder whose name changes daily
I agree with salva here. Simple globbing fits the bill nicely.
If you're a Windows programmer, not a Unix/Linux programmer, then you may not already be familiar with the ability to use globs (wildcards) for folder names as well as for file names. As a Perl programmer, folder globbing is a powerful tool you'll want to add to your toolkit.
Here's a concrete example using File::Glob::bsd_glob:
C:\>perl -MFile::Glob=bsd_glob -E "say bsd_glob('C:/Program Files/Micr +osoft Office/*/WINWORD.exe')" C:/Program Files/Microsoft Office/Office12/WINWORD.exe C:\>
(There could be a file named WINWORD.exe in more than one subfolder of C:\Program Files\Microsoft Office, so the value returned by bsd_glob is a list, not a scalar.)
Many of my Perl scripts running on Windows use File::Glob like this:
use English qw( -no_match_vars ); use File::Glob qw( bsd_glob ); @ARGV = map { bsd_glob($ARG) } @ARGV;
Jim
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Accessing a folder whose name changes daily
by JennieInMI (Acolyte) on Dec 18, 2012 at 18:34 UTC | |
by Jim (Curate) on Dec 18, 2012 at 23:20 UTC |