fensterblick has asked for the wisdom of the Perl Monks concerning the following question: ⭐ (directories)
I would use File::Recurse, but the files/directories haven't been created yet. Thanks for any suggestions. This script is driving me crazy!#!/usr/bin/perl -w use Cwd; sub MakeDirs($$$) { #my $current_dir = getcwd(); my($base, $num_dirs, $depth) = @_; #if depth = 0, no more subdirectories need to be created if($depth == 0) { return 0; } #change the directory chdir $base; #Create directories on the current level my $dir_name = "a"; for($x = 0; $x < $num_dirs; $x++) { mkdir $dir_name; $dir_name++; } #recurse over subdirectories $dir_name = "a"; for($x = 0; $x < $num_dirs; $x++) { MakeDirs($dir_name, $num_dirs, $depth-1); $dir_name++; } return 0; } MakeDirs("/hpq/", 2, 3);
Originally posted as a Categorized Question.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do I recursively create a directory tree/filesystem?⭐
by rob_au (Abbot) on Jul 22, 2002 at 02:56 UTC | |
by Ionitor (Scribe) on Jul 22, 2002 at 13:14 UTC | |
|
Re: How do I recursively create a directory tree/filesystem?
by Ionitor (Scribe) on Jul 22, 2002 at 00:30 UTC | |
|
Re: How do I recursively create a directory tree/filesystem?
by lemming (Priest) on Jul 22, 2002 at 18:09 UTC | |
|
Re: How do I recursively create a directory tree/filesystem?
by Anonymous Monk on Aug 14, 2002 at 11:35 UTC |