What if you have BIG_1/SMALL_1/doc1 and also BIG_2/SMALL_1/doc1 (that is, matching file name in both paths), but those two files happen to be different? Would the file under BIG_1 always be the one to keep, or would you replace it with the version under BIG_2, depending on size or age or whatever?

Anyway, you might just want to create two lists, one for all the data files under BIG_1, and another for all the data files under BIG_2 (File::Find or one of its variants could help with that, or the gnu "find" command-line utility). Then, the files to move are the ones in the BIG_2 list that are not in the BIG_1 list.

Writing your script to store the lists in memory as separate hashes (with "SMALL_n/filename" as the hash keys) would make it quick and easy to tell which files need to be moved. Or, if the lists are sorted, you could just use the gnu "diff" and "grep" to compare the lists and get the files that appear only in BIG_2.


In reply to Re: Move files between directories by graff
in thread Move files between directories 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.