in reply to Move files between directories

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.

Replies are listed 'Best First'.
Re^2: Move files between directories
by Anonymous Monk on Sep 01, 2009 at 06:54 UTC
    Guys thanks, I just copied all subdirectories from BIG_1 into BIG_2 and their files were merged... :)
    Thanks anyway...