Thanks to both of you that got me pointed in the right direction and I was able to get the problem worked out.

 

Eddie

 


From: Ryan Speight [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 22, 2005 2:32 PM
To: David Nicol; Eddie Willett
Cc: [email protected]
Subject: Re: xcopy

 

Be sure that your script is enclosing all of the folder/file names in quotes or it will freak out if it tries to copy somthing with spaces in it.  I have had this problem in the past.  I usually read all of the folder names into an array.  Then as I systel throught the I add quotes around them:

 

i.e.

 

@Array = readdir DIR;

 

foreach $item (@Array){

     $item = '"'."$item".'"';

     my $SysCommand = "xcopy $item $dest";

     system "$SystemCommand";

}

 

Hope this helps.
David Nicol <[EMAIL PROTECTED]> wrote:

On 9/22/05, Eddie Willett <[EMAIL PROTECTED]>wrote:
>
> I am writing a script that does and xcopy from a windows XP or 2000 machine
> to a windows NT 4 machine. When I run the script it says that is can create
> the directory. The directory that xcopy is having a hard time creating is a
> long name with a space in it for example "machine information". The program
> basically dies when it tries to create this directory. I am started using
> the dos xcopy command with the TEI switches so the line in perl was
>
> System("xcopy $source $target /t /e /I");
>
> When that was working I switched to File::Xcopy but that seems like it
> doesn't have some of the switches implemented yet. I keep getting target
> directory could not be found even though I am telling it to create any
> missing directories.
>
> I believe this to be a NT 4 problem but I wanted to see if anyone else had
> run into this and found a solution.


I'm not recalling exactly what those switches to XCOPY mean, but
a depth-first recursive file-copying program is easy enough in core perl,
it goes something like this

sub ycopy($$){
my ($source, $target) = @_;
if (-d $source){
mkdir $target;
opendir DIR, $source;
my @dirs = readdir DIR;
for my $dir (@dirs){
$dir =~ /^\.\.?$/ and next;
ycopy("$source/$dir","$target/$dir");
};
}else{
-f $source or die "Whoops, I only handle dirextories and files";
open READ, '<', $source;
open WRITE, '>', $target;
while(defined(my $piece = )){
print WRITE $chunk
}
};
};

_______________________________________________
Perl-Win32-Admin mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



______________________________________________________________________
This email transmission and any documents, files or previous email
messages attached to it may contain information that is confidential or
legally privileged. If you are not the intended recipient or a person
responsible for delivering this transmission to the intended recipient,
you are hereby notified that you must not read this transmission and
that any disclosure, copying, printing, distribution or use of this
transmission is strictly prohibited. If you have received this transmission
in error, please immediately notify the sender by telephone or return email
and delete the original transmission and its attachments without reading
or saving in any manner.
_______________________________________________
Perl-Win32-Admin mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to