Hi all,
From a .bat file on Windows i’m trying to exclude all my “.git” directories but without success.
Of course, i have read the documentation.
What i have tried:
rclone.exe --exclude **.git/** sync "D:\Documents" remoteEncrypted:Documents
rclone.exe --exclude *.git/** sync "D:\Documents" remoteEncrypted:Documents
rclone.exe --exclude **/.git/** sync "D:\Documents" remoteEncrypted:Documents
rclone.exe --exclude .git/** sync "D:\Documents" remoteEncrypted:Documents
rclone.exe --exclude */.git/** sync "D:\Documents" remoteEncrypted:Documents
Any help please ?
Thanks in advance,
Regards
TowerBR
(TowerBR)
2
Well … I exclude all my cache folders with:
- */cache/**
(in a filter file)
that is similar to yours:
*/.git/**
Maybe the dot in the folder name interfere?
Thanks for your answer, how do you use a filter file ?
Maybe will it fix the dot interference.
TowerBR
(TowerBR)
4
You will have to use the --filter-from
option.
B4dM4n
(Fabian Möller)
5
To exclude directories you can simply use --exclude .git/
The /
at the end of the filter will turn the filter into a directory filter (See https://rclone.org/filtering/#directories)
My .git folders are still uploaded with the following command from a .bat file:
rclone.exe sync "D:\Documents" remoteEncrypted:Documents --exclude .git/
Am i doing something wrong ?
Just to be sure : Does the “exclude” command work on encrypted remotes ? (on Microsoft Windows ?)
B4dM4n
(Fabian Möller)
8
I tested this on an Windows machine and the --exclude .git/
works for me:
C:\rclone-v1.42-windows-amd64> rclone.exe sync --exclude .git/ a b
C:\rclone-v1.42-windows-amd64>tree /F
+---a
¦ +---1
¦ ¦ asdf.txt
¦ +---.git
¦ ¦ config
¦ ¦ description
¦ ¦ HEAD
¦ +---branches
¦ +---hooks
¦ +---info
¦ ¦ exclude
¦ +---objects
¦ ¦ +---info
¦ ¦ +---pack
¦ +---refs
¦ +---heads
¦ +---tags
+---b
+---1
asdf.txt
If you want sync
to delete existing .git
folders in the destination, you can use --delete-excluded
.
--exclude
works for all remotes. rclone will transform filenames for encrypted remotes transparently for you.
Oh, thanks for your help! I missed the --delete-excluded
flag…
What i have now:
rclone.exe sync "D:\Documents" remoteEncrypted:Documents --exclude-from=rclone-filters.txt --delete-excluded
My rclone-filters.txt
content:
.git/
[tT]humbs.db
[dD]esktop.ini
.DS_Store
AlbumArt*.jpg
Note that the --dump filters
flag is also usefull to investigate filter-related issues.
Thanks again! How can i flag this topic as “resolved”?