Thank you all for the past responses, but all solutions have failed. Partly because I did not explain clearly enough. This is a tough one. The problem:
a file shows up in /main, it needs to move to /dir1 another file shows up in /main, it moves to /dir2 ditto for /dir3 through /dir6 then we need to start again at /dir1 a round-robbin approach to file distribution.
Now here is the seemingly impossible parts: say there are two files in main and the last time the program ran, it had moved a file to /dir2, it now needs to put one file in /dir3 and the other in /dir4. (date/time stamp of files is no issue as this will be a cron job or it will sleep and run every 5 minutes) Say this program runs again and there is a file in /main, it now needs to start at /dir5. And as if this isn't bad enough, if there is no file there, it needs to remember the last /dir# it was at and pick up from there! aaargh! I'm thinking the program can read a file with all the /dir#'s into an array, shift them somehow and white back out to the file. Do a substr to take out the valid /dir# then FORMAT a executable sh file with 'mv /main @<<<<<<' type thing. Assuming this is not impossible, Thanks for any code help I can get!

In reply to sequential file handling (yet again) by Anonymous Monk

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.