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


In reply to Re^2: New Folders by Brian268
in thread New Folders by Brian268

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.