in reply to Yet Another File::Copy problem

Copying . to . (current folder) and .. to .. (parent folder) is probably not a good thing to do. I'd skip those with something like:

next if $all_qa_files =~ /\.\.?$/;

DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^2: Yet Another File::Copy problem
by ikegami (Patriarch) on Feb 22, 2006 at 02:14 UTC

    That should be

    next if $all_qa_files =~ /^\.\.?$/;

    But even that's not good enough. copy cannot copy directories, so you need to skip all directories, not just the special ones. The following will do the trick:

    next if not -f "$qa_dir$all_qa_files";
Re^2: Yet Another File::Copy problem
by djbiv (Scribe) on Feb 22, 2006 at 01:33 UTC
    interesting enough, skipping '.' and '..' resolved this issue. I appreciate that comment and glad I added it before waiting for other results.
    now, any explanation for it failing when now exlcluding '.' or '..' for my simple mind?

      Simply stated, '.' refers to the current directory; '..' refers to the current directory's parent. Trying to copy those causes problems, and is usually not what you intend. However, readdir reads those two as 'files', so you have to skip them.

      If you're still getting errors, you may need to check that you're actually creating the directories you think you are. In particular, I am suspcious of the ending backslash, which I believe may be an error. So - omitting the copy, are your directories actually being created? Also, I'm thinking that you need to be using forward slashes, even though you're on Windows. I know I do well enough when I use $dir="level1/level2/etc"; (note the double quotes). You can use this form for specifying a file path:  $path="$dir/$file";, which works.