Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to synchronize all the PDFs from one directory (my Zotero library) to Dropbox. Finally, I want to have a list of all the PDFs, not the directory names.

I successfully synchronized all my PDFs with the following command:

rsync -az --include="*/" --include="*.pdf" --exclude="*" \ 
--prune-empty-dirs /zotero /dropbox

I think I can easily set up a cron job to redo that task every day, but haven't tried that yet.

But now my folder on Dropbox still has all the directories with the PDFs in it (e.g. 6NVTACJH > xyz.pdf)

My problem: I would love to only have all the pdfs listed in one directory. Following an advice from the web, I tried to find all pdfs and create a hardlink.

But this command does not work yet.

ln $( find -name="*.pdf" -type f - links 1 ) /dropbox

Can you please help me with that last command?

share|improve this question

I suggest using find -exec rather than command substitution cos it handles filenames well.

If you are trying to copy all pdf files into one single level /dropbox dir?

find /zotero -type f -name '*.pdf' -exec cp {} /dropbox/ \;

If you want links:

find /zotero -type f -name '*.pdf' -exec ln {} /dropbox/ \;

Update: You can use rsync on single file, just replace cp/ln with rsync(This will be slow):

find /zotero -type f -name '*.pdf' -exec rsync -avz {} /dropbox/ \;

Another choice is tar, which also provide updating by access time function.

I have to ask why you need to do this, you use Dropbox's limited version control? Or are you using Dropbox to share the files on-the-fly?

For those I need versioning and alpha-updating I personally have git or bazaar repository resides in Dropbox folder, do commit in my local dir, then push to Dropbox folder, simply faster than any hoster.

share|improve this answer
Thanks for your answer. The only problem I see is that I constantly add new items to Zotero, so I have to rerun the script. But if I try to copy ALL PDFs again, there might be a problem for a cron job, right, because I would need to override existing file. What do you think about that? – mcbetz Oct 29 '12 at 15:01
As update, you can rsync a single file one by one – MeaCulpa Oct 31 '12 at 2:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.