tankergoblin
asked on
how to unzip a file from one folder to another folder
say no my zip file is in a folder and i want to move the unzip a file to b folder how?
ASKER
i dont have extract package
ASKER
below is use for testing
#!/usr/bin/perl
use File::Copy;
move("c:/a.txt","d:/a.txt" ) or die "File move failed $!";
i receive error saying that
file move failed bad file descriptor at c:/test.pl line 4.
#!/usr/bin/perl
use File::Copy;
move("c:/a.txt","d:/a.txt"
i receive error saying that
file move failed bad file descriptor at c:/test.pl line 4.
tankergoblin,
What perl distro are you using? Could you add the Archive::Extract package?
What are you using to unzip (where is it from) as I would need to look at its options to see if it can.
I could find nothing wrong with your short script for testing the move() ... it works for me, I had to use a sub-directory as I get permission problems using the root c:\ directory.
Did you try using a different directory to the "root" directory?
Another guess, but try using DOS directory back slashes, you will need to use single quotes for that to work:
use File::Copy;
move('c:\a.txt','d:\a.txt' ) or die "File move failed $!";
lwadwell
What perl distro are you using? Could you add the Archive::Extract package?
What are you using to unzip (where is it from) as I would need to look at its options to see if it can.
I could find nothing wrong with your short script for testing the move() ... it works for me, I had to use a sub-directory as I get permission problems using the root c:\ directory.
Did you try using a different directory to the "root" directory?
Another guess, but try using DOS directory back slashes, you will need to use single quotes for that to work:
use File::Copy;
move('c:\a.txt','d:\a.txt'
lwadwell
ASKER
are you using linux ??
ASKER
im using Archive::Zip;
ASKER
i also tried rename as below
rename ("c:/a.txt","d:/a.txt") or die "File move failed $!";
cannot also
rename ("c:/a.txt","d:/a.txt") or die "File move failed $!";
cannot also
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i dont get any error
i use rename to move my file from one drive to another.
but after i run the file is not moved to the drive i want it to be..
i use rename to move my file from one drive to another.
but after i run the file is not moved to the drive i want it to be..
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To move (or copy) files I suggest you use the the File::Copy package .. if the file was called "a.txt" then:
use File::Copy;
move("/old/folder/a.txt","
To do the unzip into another folder, suggest you use the Archive::Extract package:
use Archive::Extract;
my $zip = Archive::Extract->new( archive => '/path/to/test.zip' ); # specify the file to unzip here
my $ok = $zip->extract( to => '/new/folder' ) or die $zip->error; # specify the folder to unzip into here
lwadwell