Exclude Hidden Files?


Fairly new to rclone. Just starting using it this evening. I’ve managed to get files uploading to Cloud Drive so off to a good start.

One thing I have noticed is it syncing up the hidden files as well which I don’t want it to do. Can anyone give me an example of a command with an exclude hidden files filter for “rclone sync”.



Which OS are you on?

Do the hidden files have names you can recognise (eg start with a . or something?) Or are they hidden with attributes of the file?


macOS Sierra. Yeah they are mac ones. .DS_Store etc… Couple of other ones. I’ll have to check after the next upload and confirm.

If you can name the files you want excluded then you can use this to exclude them.


Not sure I can name them exactly without seeing what they are first. Sure I can enable show hidden files but to have to specify each one every time will become cumbersome. Can I not use some kind of wildcard? So that any files (or folders) that start with “.” are excluded?

Sure. To exclude all files starting with . you would use --exclude '.*', to exclude all files in a directory starting with . you would use --exclude ‘.*/**’

You can combine the two to make this --exclude '.*{/**,}'

Or put this in a file


And use --exclude-from file which gives you a chance to add other excludes you find

1 Like

sorry for the n00b question, but how do I exclude the .DS_Store files?

would it be simply:

–exclude “.DS_Store”

(searched for an answer, so hopefully if that’s correct it will help other beginners)

That will exclude a file called .DS_Store anywhere on the filesystem - so looks good to me!

1 Like

Thanks Nick. Is there a way to remove any “.DS_Store” files that may have already been uploaded to my GDrive whilst testing?

If you use the --delete-excluded with rclone sync flag then it will remove any excluded files. NB this command is very dangerous so test first with --dry-run!

Alternatively find all the DS_Store files like this

rclone ls --include .DS_Store ls drive:

Then delete them like this

rclone delete --include .DS_Store ls drive:

rclone ls --include .DS_Store drive:

thanks (I removed the extra ls in your example and it seemed to work)

1 Like

Is there any way to make these exclusions persistent? I.e. put them in the rclone.conf file or similar?

Annoying to have to specify them on the command line every time (yes I know I can put them in a file, but that still requires me to use the --exclude-from-file flag every time).

This would be akin to a .gitignore file in Git, for example.

They can’t go in the config file at the moment.

There are proposals for a .rcloneignore style file in the issues.

You can also set an environment variable which rcclone will use to save typing, eg RCLONE_EXCLUDE_FROM=/path/to/file

I put both lines but rclone ls --filter-from exclude-files.txt outputs Failed to load filters: malformed rule ".*"
Anyway the rule seems to be followed.
And also as I understand, adding a third line /home/pi/Pictures/* will exclude only files, not folders belonging to Pictures. This rule is not followed.
PS: relative path works good