I use this code to copy all .txt files from a cd drive (d:)

Snip

foreach $dfile (glob("d:/*.txt")){
       $ddfile = "c:/" . substr($dfile,8);
       if (-e $ddfile) {
          unlink($ddfile) or warn "Cant unlink $ddfile: $!\n";
       }
       copy("$dfile", "$ddfile") or warn;
       Win32::File::SetAttributes( $ddfile, $Attrib | ARCHIVE )
     }

It takes all file from the drive and if they exist on the target dir, deletes them, 
then copy's them and finnaly sets the attribute from readonly, which is the default 
from a cd.

HTH


Ned Cunningham
POS Systems Development
Monro Muffler Brake
200 Holleder Parkway
Rochester, NY 14615
(585) 647-6400 ext. 310
[EMAIL PROTECTED]

                -----Original Message-----
                From:   [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John 
Deretich
                Sent:   Thursday, November 13, 2003 10:27 AM
                To:     Perl-Win32-Admin-Request (E-mail)
                Subject:        copy files and directories

                Hello,

                can anyone tell me how to do
                a complete copy of files and directories
                from one directory to another?
                I tried system('copy g:\*.* F:\test\test2')
                with no success.

                thanks,

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

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

Reply via email to