rsync can not delete .git/objects directory files
You would be ok with a script that first changes the permissions.
It could work on specific directories or on all .git/objects
in a (sub)set of directories.
Taking as an example the command line you posted in the question
rsync -ab --delete-delay /media/blueray/WDRed /media/blueray/UltrastarDaily
and naming rsync_my.sh
script below,
#!/bin/bash
TARGET="${@:$#}" # last parameter
SOURCE="${@:(-2):1}" # second to last parameter
TARGET2="${TARGET}/$(basename ${SOURCE})/_Working/_NotesFiltered/
for d in $(find ${TARGET2} -type d -name .git) ; do
chmod -R +w $d/objects
for d2 in $(find ${d} -type d) ; do
chmod +x $d2
done
done
rsync "$@"
you would execute
$ chmod +x rsync_my.sh
$ ./rsync_my.sh -ab --delete-delay /media/blueray/WDRed /media/blueray/UltrastarDaily
The first command is needed only once. SOURCE
would be /media/blueray/WDRed
and TARGET
would be /media/blueray/UltrastarDaily
.
Please test it and post feedback.
To test, you could
- Put together a dummy directory/file structure with some 10 files that replicates the essential structure of your target dir, and execute the script.
- With
rsync
, use option--dry-run
to only see what would be done, and create a log file that you can later inspect with--log-file=mylog.log
.
Parameter expansion/extraction may need fine tuning.
Related:
- https://stackoverflow.com/questions/41382232/git-objects-directory-contents-make-git-set-the-write-permission-instead-of
- https://stackoverflow.com/questions/6448242/git-push-error-insufficient-permission-for-adding-an-object-to-repository-datab/6448326