Using exclude and include in single command

I am using rclone1.65.1 on windows to copy specific files only from source to destination.
My include file lists the certain formats to be copied :
INCLUDE.txt

*.txt
*.c
*.py
*.doc

The specific files to be excluded are specified in
EXCLUDE.txt:

doc/tutorial.doc
data/d1.txt
data/d2.txt
examples/example1.c
examples/example2.c

The source contains following files :

tutorial.doc
Help.txt
doc/tutorial.doc
data/d1.txt
data/d2.txt
examples/example1.c
examples/example2.c
play.py
/help/Instructions.doc

After applying INCLUDE.txt and EXCLUDE.txt ,Destination must have following files only :

tutorial.doc
Help.txt
play.py
/help/Instructions.doc

How can I skip copying those files listed in EXCLUDE.txt but copy other .c , .txt , .py & .doc files ?

As per docs:

Important Avoid mixing any two of --include..., --exclude... or --filter... flags in an rclone command. The results might not be what you expect. Instead use a --filter... flag.

I also tried --filter-from with the following file :

+ *.txt
+ *.c
+ *.py
+ *.doc

- doc/tutorial.doc
- data/d1.txt
- data/d2.txt
- examples/example1.c
- examples/example2.c

But rclone copies all the files.

As per docs:

Within --include-from, --exclude-from and --filter-from flags rules are processed from top to bottom of the referenced file.

so you should put exclusions first.

1 Like

Thanks a lot. This worked well.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.