Exclude Hidden Files?


#1

Hi,

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”.

Thanks,

Damien


#2

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?


#3

Hi,

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.


#4

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

http://rclone.org/filtering/


#5

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?


#6

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


#7

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)


#8

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


#9

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


#10

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:

#11

rclone ls --include .DS_Store drive:

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