You are not logged in.
i made an alias to sync my dot files which is:
sudo rsync -avh --exclude={'.Trash-1000','.cache'} ~/.[^.]* /mnt/timeshift/dotfiles/ --delete
reading the documentation i understand that since the source is expressed with a final * every file in the parent directory is considered as a source, then the --delete flag only works on subdirectories.
the result i'm looking for is a rsync command that copy every dotfile in my home directory and every dotfolder and relative subfolders with the -- delete flag working on every file synced. Any advice?
thank you!
Last edited by difri84 (2022-07-30 00:25:33)
Offline
You could try:
rsync -avh --exclude '.Trash-1000' --exclude '.cache' --include '/.*' --exclude '/*' --delete ~/ /mnt/timeshift/dotfiles/
That way you operate on entire directories and the selection of dot file happens solely via rsync's include/exclude. This command will however not delete explicitly excluded data from the target, so if some non-dot-file got synced (or .Trash-1000 or .cache), they will stay.
I only tried this very briefly, so make sure with a dry-run that this command does what you want it to do.
Offline
this works as intended
rsync -avh --exclude={'.local/share/Trash','.Trash-1000','.cache','.config/whatsapp-nativefier*','/[^.]*'} ~/ /mnt/timeshift/dotfiles/ --delete
the key is the last exclude parameter
/[^.]*
which means any file not starting with a dot in the main directory (thanks to the initial /, otherwise it would have excluded any non dot file in subfolders too), apparently the --include section is not needed at all.
modify this according to your needs!
thanks for the idea!!!
Last edited by difri84 (2022-07-30 00:23:52)
Offline