[Linux general] copy diff of 2 folders to a separate folder
Brian McKee
brian.mckee at gmail.com
Wed Mar 10 22:03:12 UTC 2010
On Wed, Mar 10, 2010 at 2:08 PM, Thomas Kaiser <ubuntu at kaiser-linux.li> wrote:
> When I diff to folders, I get a output like this:
> Only in /var/www/images/stories/fruit: ABS.jpg
>
> Now, I would like to copy the "Only in" to a different folder (with full
> path name, if possible).
ugly as sin, but I suspect works (untested!)
diff -rq folder1 folder2 | awk -F ': ' '{print $2}' > listOfFilesToCopy.txt
for ITEM in $(cat listOfFilesToCopy.txt) ; do cp -v "$ITEM" outputFolder ; done
You'll want to review listOfFilesToCopy.txt before you run step two -
and I'd insert an echo in there to make sure of the output the first
time thru the loop.
Not responsible if you dog joins AA etc....
Brian
--
Hey, it's your computer.... isn't it?
More information about the ubuntu-users
mailing list