[Linux general] copy diff of 2 folders to a separate folder
Steve Flynn
anothermindbomb at gmail.com
Wed Mar 10 22:27:10 UTC 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 10/03/10 22:03, Brian McKee wrote:
> 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
I was messing with something similar. Just got around to posting it only
to find you'd beaten me to it.... curses.
(
IFS=":\t\n"
diff folder1 folder2 | (read filler filler dir file && echo $dir $file >
tempfile.$$)
loop over tempfile.$$ as Brian has done above.
)
- --
Steve Flynn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkuYHL4ACgkQpOzvLkUb86BsGwCbBbydx5IBjhlpgKoq/RS/Eke7
MKQAoLorheC0tgFB5vry230P4nXtFIjC
=2ycq
-----END PGP SIGNATURE-----
More information about the ubuntu-users
mailing list