Hi,
I tried the option given by you but it's throwing following error.
Undefined subroutine &main::syscopy called at C:\irfan\backup.pl line 20
I did following thing
use file::Xcopy;
syscopy("D:\\vobs","D:\\backup");
Any sol. on this plz?
Regards
Irfan Sayed
Irfan J Sayed/India/[EMAIL PROTECTED]
04/06/2006 10:50 PM
To
"Chas Owens" <[EMAIL PROTECTED]>
cc
[email protected]
Subject
Re: windows command help
Thanks Chas,
That is what i was looking for.
Regards
Irfan Sayed
"Chas Owens" <[EMAIL PROTECTED]>
04/06/2006 10:38 PM
To
Irfan J Sayed/India/[EMAIL PROTECTED]
cc
[email protected]
Subject
Re: windows command help
On 4/6/06, Irfan J Sayed <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I need to run the windows copy command from command prompt to copy
several
> folders and files in specific folder to another folder
>
> I am running following command
>
> C:\Documents and Settings\Administrator>copy D:\vobs d:
> D:\vobs\*
> The system cannot find the file specified.
> 0 file(s) copied.
>
> C:\Documents and Settings\Administrator>
>
> plz let me know what is the wrong
>
> Regards
> Irfan Sayed
Assuming that you need to do this inside a Perl program, you might
consider using File::Xcopy.
use File::Xcopy;
syscopy("D:/vobs", "D:");
If File::Xcopy is not installed and you do not have permission to
install modules then you can roll your own with the core modules
File::Copy, File::Basename, and File::Path. Something like this
(warning untested):
use File::Copy;
use File::Basename;
use File::Path;
deepcopy("D:\vobs" "D:");
#N.B. this does not use glob'ing, so the first argument must either be
a directory or file
#glob'ing could be added using the glob() function
sub deepcopy {
my ($entry, $dest) = @_;
if (-d $entry) {
my $top = basename $entry;
mkpath "$dest/$top";
opendir DH, $entry;
while (my $new = readdir DH) {
deepcopy("$entry/$new", "$dest/$top");
}
closedir DH
} else {
copy($entry, $dest);
}
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>