On Thu, 25 Mar 2010, Vitaly V. Ganusov wrote: > However, it seems like a very messy way to sync a given file (by > excluding bunch of other files that are not needed). Would you suggest > a better way? Could you suggest a simple way/script to generate such > a file (see attached) with only a few files being included in the > rsync line? >
If you want to transfer only certain files, just list them in a file (relative to the source directory), and use the --files-from= argument. E.g., create the file 'test.files' ==== test.files ===================================== .mozilla-thunderbird/afc5fv2p.default/abook.mab .mozilla-thunderbird/afc5fv2p.default/storage.sdb .mozilla/firefox/5dpdgl81.default/bookmarks.html .mozilla/firefox/5dpdgl81.default/places.sqlite ===================================================== Then, using your example: (\'s to avoid mail splitting) rsync -aunvz --delete -e ssh --files-from=test.files \ /home/vitaly/ \ utk:/home/vitaly/ Unless I'm mistaken, you can include directories. If that's not what you meant (a list of specific files), you might just be interested to know that you can use '*' to exclude everything not already included: e.g., where you had: > + .mozilla-thunderbird/ > + .mozilla-thunderbird/afc5fv2p.default/ > + .mozilla-thunderbird/afc5fv2p.default/abook.mab > + .mozilla-thunderbird/afc5fv2p.default/storage.sdb > - .mozilla-thunderbird/afc5fv2p.default/ImapMail > - .mozilla-thunderbird/afc5fv2p.default/Mail > - .mozilla-thunderbird/afc5fv2p.default/lock > - .mozilla-thunderbird/afc5fv2p.default/extensions You could simplify that to: + .mozilla-thunderbird/ + .mozilla-thunderbird/afc5fv2p.default/ + .mozilla-thunderbird/afc5fv2p.default/abook.mab + .mozilla-thunderbird/afc5fv2p.default/storage.sdb - .mozilla-thunderbird/afc5fv2p.default/* (The last line *doesn't* exclude abook.mab or storage.sdb) -- Best, Ben -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html