zentara has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; use File::Find; use File::Path 'mkpath'; #usage dirtreeclone fromdir todir No trailing slashes my $from = shift || '.'; my $to = shift || "$0-tmp"; my @dirs; find (sub {push @dirs => $File::Find::name if -d},$from); foreach my $dir(@dirs){ mkpath("$to/$dir"); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: cloning a directory tree
by tachyon (Chancellor) on Jan 02, 2003 at 23:05 UTC | |
|
Re: cloning a directory tree
by fruiture (Curate) on Jan 02, 2003 at 22:58 UTC | |
|
Re: cloning a directory tree
by tachyon (Chancellor) on Jan 02, 2003 at 22:46 UTC | |
|
•Re: cloning a directory tree
by merlyn (Sage) on Jan 03, 2003 at 00:21 UTC | |
|
Re: cloning a directory tree
by steves (Curate) on Jan 03, 2003 at 06:55 UTC | |
|
Re: cloning a directory tree
by hardburn (Abbot) on Jan 03, 2003 at 15:11 UTC | |
|
Re: cloning a directory tree
by toma (Vicar) on Jan 04, 2003 at 06:45 UTC |