Hi all,

        I want to create a new directory but I need to make sure that it's valid.  
Here is what I want to do.  Given a starting file hierarchy of something like 
this
Top Level
        .hidden
        Sub Level 1a
                .hidden2
                Sub Level2a
                Sub Level2b
        Sub Level 1b
                Sub Level2c
        Sub Level 1c
        Sub Level 2c

I need a perl script that using a variable $levels can return all of the 
directories for the given level.  (Think of this like a "find -maxdepth 
$level")  The problem with find is that it returns hidden values and is not 
system independant.

So In theory this function would be called like
my $level = "2";
my $start = "/home";

$dir = &GetDirectory($start, $level)

sub &GetDirectory {
   my $dir;
   while ( -d $dir) {
      system "ls?"

# I only want it to list the directories for the level
# Example
# /home/SubLevel1a/SubLevel2a
# /home/SubLevel1a/SubLevel2b
# .
# .
# /home/SubLevel2c

      print "plese enter in the directory for the new directory: ";
      Functionhere
      Functionhere
      Functionhere
      if ( ! -d $dir ) { $dir="" ; } else { return $dir; }
   }

Does anyone have any ideas for this?

Thanks so much
-- 

 Steven M. Klass
 Physical Design Manager

 National Semiconductor Corp
 7400 W. Detroit Street
 Suite 170
 Chandler AZ 85226

 Ph:480-753-2503
 Fax:480-705-6407

 [EMAIL PROTECTED]
 http://www.nsc.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to