Current code I am working on to upload specific files and specific folders to an ftp server.
Currently there is no ftp module loaded. !!This is a test peice of software!!
#!/usr/bin/perl
use DirHandle;
sub dunno{
system "cls";
print"Enter the path that you would like to search for\n";
chomp(my $path =<>);
my $dir ="c:/$path";
my $dir2 = new DirHandle "$dir";
if(defined $dir2){
while(defined($_= $dir2->read)){
foreach my $dir3($_){
next if($dir3 =~ m/\.+/);
#print "$dir/$dir3/\n";
dunno2($dir,$dir3);
}
}
}
}
sub dunno2{ # Current limitations include only working if all D
+irs include whatever filetpye.
# Otherwise you end up with dir listings along with the fi
+lename
## Below is a section of code that will be need for later use
#my $type;
#print "Enter the filetype that you would like to copy\n";
#chomp($type=<>);
## End commented code ##
my $type = "*.pl";
my ($dir3,$dir4) =@_; # Getting values from the values pass
+ed to sub
my $dir5 = "$dir3/$dir4"; # Adding them together for use in the
+ file glob
my @file = <$dir5/$type>; # or die "no $type in $dir5\n";
foreach my $list(@file){ # List all pl file found in dir
my $list2 = $list; # Declaring for later use. Don't wamt to
+ clobber the original value
my $list3 = $list; # Declaring for later use. Don't wamt to
+ clobber the original value
#next if($list2 =! m/\w$/);
$list2 =~ s/^(.+\/)(.+?)$/$2/; # Sets to filename **Works**
#$list2 =~ s/^(.+?\/)(.+?)$/$2/; # Removes c:/ **Works**
$list3 =~ s/^(.+?\/)(.+?\/)(.+?\/)(.+?)$/$3/; # Sets to fol
+der name **Works** See note below
# Had to remove the 4th search due to folder type on t
+his laptop
# Test portion of the script. Allow me to set and call routine
+s, print statements, etc.
# They are down here so that the code is easier to read.
#print "$3";
#my $list4 = $list3;
#$list4 =~ m/\w/;
print "$list2\n";
}
}
dunno();
|