How to sync files with rclone excluding extensions that have more than 3 characters?

I'm syncing some files in my S3 bucket with rclone and all is ok. I need to exclude from sync all files with more than 3 characters on extensions (e.g. test.jfjaoisfn) in case of ransomware attack or events like that. Is there a way to use a variable? Thanks a lot and have a great day. Giulia

Not going to discuss reason you stated, as your approach seems to be a bit naive (as if ransomware used some defined schemes) but there are many ways to do such exclusions. Most obvious being:

$ ls
file        file.1      file.12     file.123    file.1234   file.123456

$ rclone ls . --exclude "*.????*"
        0 file
        0 file.1
        0 file.12
        0 file.123

It was an hypothesis, it’s not a solution but an help, unfortunately i really know how the ransomware works. I try your suggestions, so, meanwhile, thanks a lot!

1 Like