Hi, There is a small problem now : It now copies the files as directories : #!/usr/bin/perl $startDir = q{c:\test}; $newDir = q{c:\new}; &myReadDir($startDir); exit 0; sub myReadDir { my ($dir) = @_; print "\n\nProcessing $dir \n" ; my (@dirs,$list); opendir(DIR,$dir) || warn "can't open the directory $dir: $!\n"; [EMAIL PROTECTED] {!(/^\./) && -d "$dir\\$_"} readdir(DIR); @dirs=grep {!(/^\./)} readdir(DIR); closedir (DIR); for $list(0..$#dirs) { print "list = $list\n" ; mkdir ($newDir) unless -d $newDir; #mkdir ($newDir) ; $ndir = $dir; $ndir =~ s/c:\\test/c:\\new/; print $ndir."\\".$dirs[$list],"\n"; mkdir ($ndir."\\".$dirs[$list]); &myReadDir($dir."\\".$dirs[$list]); } return 1; } Can somebody point how to fix this ? Regards, Alok.
"John W. Krahn" <[EMAIL PROTECTED]> wrote: alok nath wrote: > Hi, Hello, > I wanted to recursively copy the contents of a directory(both directory > and files) from one folder to the other. > The below code does only copy of directories but leaves behind files. > Can anybody help me how to do that ? http://search.cpan.org/~dmuey/File-Copy-Recursive-0.35/Recursive.pm John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ --------------------------------- You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.