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 = <READ>)){
            print WRITE $chunk
        }
    };
};

_______________________________________________
Perl-Win32-Admin mailing list
Perl-Win32-Admin@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to