silentrebel
November 9th, 2009, 07:41 PM
I require a solution for this problem:
Let there be a directory original/ with the following structure:
original/
++-dir1/
++++-file1
++++-file2
++++-file3
++-dir2/
++++-pic1
++++-pic2
Let there also be a file named directives with the following content:
dir1/
dir2/pic1
How would I recursively copy the contents of original/ to new/ and exclude the files and directories listed in directives. The original directory tree must be reproduced in new/.
I've tried a few things with find and xargs to little avail (they would copy all the files to new (except those in the excluded directories), but the directory tree would not be preserved).
I'm starting to think about writing my own recursive copy function, but there must surely be an easier way...
Thanks,
silentrebel
Let there be a directory original/ with the following structure:
original/
++-dir1/
++++-file1
++++-file2
++++-file3
++-dir2/
++++-pic1
++++-pic2
Let there also be a file named directives with the following content:
dir1/
dir2/pic1
How would I recursively copy the contents of original/ to new/ and exclude the files and directories listed in directives. The original directory tree must be reproduced in new/.
I've tried a few things with find and xargs to little avail (they would copy all the files to new (except those in the excluded directories), but the directory tree would not be preserved).
I'm starting to think about writing my own recursive copy function, but there must surely be an easier way...
Thanks,
silentrebel