in reply to New Folders

Of course

my $New = "F:\\temp\\Test\\Test14.jpg"; my $Old = $New; copy("$Old", "$New");

gives an error; one can't copy a file over itself.

You didn't ask a question. You didn't say what your code should do. I don't know how you want us to proceed.

Replies are listed 'Best First'.
Re^2: New Folders
by Brian268 (Novice) on Dec 15, 2011 at 12:04 UTC

    it sounded OK in my head

    in the real world I have many groups of files spread out over multiple folders each group has the same file name within it e.g. Test01.jpg .. Test100.jpg so the first group will go into folder1 the second in folder2 etc. First test if Test1\Test01.jpg exists

    If it does then create a new folder by adding a 1 to the end of the folder name and test again until the folder N does not exist then copy the old file into the new folder thus sorting into groups

    What I need to know is why when I first run the script the folder Test1 is created but it still tries to copy the file over itself. Yet the second time I run it Test1 exist but is empty folder Test2 is created and the file is copied

    Hope that make sence