Files starting with DOT aka .*{/**,}

I'm trying to exclude all files & directories starting with "DOT" , the command .{/**,}* works great in exclude command while doing a sync

rclone sync A: B: --exclude '.*{/**,}'

For the life of me , I can't figure how to use the same in a filter file . All files get synced. content of a.txt

- .*{/**,}
- '.*{/**,}'

rclone sync A: B: --filter-from /location/a.txt

The "." character is a metacharacter so you need to escape it.

felix@gemini:~/test$ ls -al
total 8
drwxrwxr-x  3 felix felix   32 Jun 22 05:56 .
drwxr-xr-x 19 felix felix 4096 Jun 21 23:11 ..
-rw-r--r--  1 felix felix  413 Jun 22 05:56 hosts
drwxrwxr-x  2 felix felix   19 Jun 22 05:56 .test
felix@gemini:~/test$ rclone ls /home/felix/test
      413 hosts
      413 .test/hosts
felix@gemini:~/test$ rclone ls /home/felix/test --exclude '\.**'
      413 hosts
felix@gemini:~/test$

Hmm. You don't want the single quotes so just this should be OK

- .*{/**,}

However it is probably easier to use

When I try the two forms they make the same regexp for matching

$ rclone lsf --exclude '.{/**,}*' notfound --dump filters
--- start filters ---
--- File filter rules ---
- (^|/)\.(/.*|)[^/]*$
--- Directory filter rules ---
- (^|/)\.(/.*|)[^/]*$
--- end filters ---
2020/06/22 11:18:36 ERROR : : error listing: directory not found
2020/06/22 11:18:36 Failed to lsf with 2 errors: last error was: error in ListJSON: directory not found
$ rclone lsf --filter-from /tmp/filter notfound --dump filters
--- start filters ---
--- File filter rules ---
- (^|/)\.[^/]*(/.*|)$
--- Directory filter rules ---
- (^|/)\.[^/]*(/.*|)$
--- end filters ---
2020/06/22 11:18:46 ERROR : : error listing: directory not found
2020/06/22 11:18:46 Failed to lsf with 2 errors: last error was: error in ListJSON: directory not found

That looks OK to me so I'm not sure what is going on - what does --dump filters show for you?

Note also that --exclude '.**' is simpler and does the same thing. I should probably put this in the docs!

HI Guys,

Thanks for the reply. I'm still trying to wrap my head around some of the syntax here. Exclude is really easy to do but it's just preferred to keep everything in a file neatly.

@Animosity022 exclude works fine !

@ncw - .*{/**,} works fine without the inverted commas

-excluded --dump filters
--- start filters ---
--- File filter rules ---
- (^|/)\.[^/]*(/.*|)$
--- Directory filter rules ---
- (^|/)\.[^/]*(/.*|)$
--- end filters ---
1 Like

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