On Wednesday 05 December 2007 15:59, Steve Bertrand wrote:
>
> I have a quick & dirty question on directory management, and I'd like
> to whip up a solution once, and reuse as necessary.
>
> There is a directory structure, in which I want to tar up X number of
> directories every year. Here is the structure:
>
> / -
>
>   |-  a
>   |
>       |  - 2003
>       |  - 2004
>       |  - 2005
>       |  - 2006
>       |  - 2007
>   |
>   |-  b
>   |
>       |  - 2003
>       |  - 2004
>       |  - 2005
>       |  - 2006
>       |  - 2007
>
> ..z etc.
>
> What I need to do is have a script that can pollute a text file with
> the full path to each directory that is < 2005. I only need the
> directory names, not the files within.
>
> The results will be read via another process, which will proceed to
> tar/gz those dirs, remove the originals, and dump the tarballs to
> other media. (This piece is complete, I just need to get the names).
>
> I'm thinking File::Find, as well as just a standard Unix find . -type
> f -maxdepth, but for the current moment, I'm drawing blanks in midst
> of several other things I'm trying to do.
>
> Essentially, I need the following populated to a file:
>
> /a/2003
> /a/2004
> /b/2003
> /b/2004
>
> ...etc.
>
> I can provide code, but to be honest, I am working so hard on
> developing module subroutines for RADIUS accounting/billing
> management, I'm just hoping for an easy one-liner....(sorry).

Why can't you just use file globbing in the shell:

tar -c /[a-z]/200[24]



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to