CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
Will this work?



Dec 27, 2007, 6:39 PM

Post #1 of 2 (817 views)
Will this work? Can't Post

Hi everyone!!!

I have never tried this code yet but i just want to ask if this would work?


my $dirname = "/my/directory/temp/".$foldername; #folder name is extracted from database

my $filename = <filename>; #filename is also extracted from database

opendir(HANDLER, $dirname) or die "Directory cannot be open!";
my $tmpFile = grep{/$filename/} readdir HANDLER;
close HANDLER;
move($dirname.$filename, "/my/directory/archive/".$foldername);

Question: $filename may contain a file with or without an extension. Will this work on both ways? Will it also work if there are spaces within the filename?


Dec 27, 2007, 10:34 PM

Post #2 of 2 (813 views)
Re: [Vlhadv] Will this work? [In reply to] Can't Post

move() is not a perl function so it will not work. move() might be a function of a perl module, in which case you should read the documentation of the module and try the code and see if it works.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives