I am working on setting up cron jobs,and I am new to this. The purpose is to analyze the new data that is generated.The data is present in directories.

I want to sync only the latest data/that has not been analyzed for which I created a list of directories that have been analyzed(to be excluded).The below command I am using to sync data from source with a certain pattern to destination.

rsync -av --exclude-from=/home/list1 /datasets001/*/Pr*/*RNA* $TMPDIR/raw_fastq

The issue is the above command behaves same as the below command and does not exclude any data mentioned in list1.

rsync -av  /datasets001/*/Pr*/*RNA* $TMPDIR/raw_fastq

few lines of list1 are present below:


Also,any other suggestions to sync the new data and analyze it(based on date) are welcome.


There are two problems;

The first is that you have defined the exclude-from paths as relative paths rather than absolute; try adding a leading '/'.

The second is that you have explicitly provided the source paths, which (I think) is going to override the exclude-from.

If you remove the paths from the exclude list it may work the way you want, ie just have an exclude file like:


Or you could use something like:

rsync -av --exclude-from=/home/list1 \
          --include='/' --include='/*' --include='/*/Pr*' --include='/*/Pr*/*RNA*' \
          --exclude='*' \
          /datasets001/ "$TMPDIR/raw_fastq/"

(note that the order of exclude and include is important, the first match applies)

This will however preserve the source directory structure in the target dir, which may or may not be what you want.

  • Removing the paths from the exclude list worked.Also,I noticed having more than one newline characters between the lines also works.
    – Ron
    Jun 2 '16 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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