Ignoring/excluding folders from the remote

What is the problem you are having with rclone?

Hi!

I'd like to know if it's possible to exclude some folders for deletion at the remote instead of the host.

I have a ~/Pictures folder with the following structure:

PhotoPrism
similarity.db
digikam4.db
Photos
thumbnails-digikam.db
existing_shortcuts.pickle
recognition.db
venv
Media
remove_live_photos.py

which I recurrently sync to drive:Pictures, which becomes:

PhotoPrism
Photos
existing_shortcuts.pickle
remove_live_photos.py

The command to sync this directory (below) excludes lots of folders and files because many folders are just databases and thumbnails we can easily recreate from original pictures.

After synching that, I usually run a second script to create an Albums directory, so that it becomes:

Albums (created with a second script)
PhotoPrism
Photos
existing_shortcuts.pickle  
remove_live_photos.py

Now, this Albums directory is somewhat special. It contains lots of shortcuts to the Photos organized by their metadata. This is quite useful because all photo services, like google photos, etc... just throw away any metadata you have besides the time and location, so it's either this or effectively losing the metadata.

Since creating shortcuts take a long time since there's no bulk operation: it takes 32 threads running for 2 days to create them. It only works because the scripts include some logic to infer what shortcuts have already been created.

Because it's not easy to recreate these shortcuts and the first sync command always deletes Albums, I would like to know if it's possible to run the first sync command in a way that it

(i) wouldn't delete this Albums directory and
(ii) wouldn't require me to write a script calling sync for each file and directory in ~/Pictures that is not Albums.

So the end result would be:

Albums                    (simply not deleted instead of sync/copied from `~/Pictures`)
PhotoPrism                (sync/copied from `~/Pictures` as usual)
Photos                    (sync/copied from `~/Pictures` as usual)
existing_shortcuts.pickle (sync/copied from `~/Pictures` as usual)
recognition.db            (sync/copied from `~/Pictures` as usual)
remove_live_photos.py     (sync/copied from `~/Pictures` as usual)
(other dirs excluded properly)

I've already tried --exclude "Albums/**", but this would only ignore any Albums directory on the host. It doesn't stop it from deleting the Albums directory at the remote.

It would also be useful if it were possible to erase dangling shortcuts at once somehow. I saw a question about this somewhere, but the links in the answer were not working anymore.

Thanks! :handshake:

Run the command 'rclone version' and share the full output of the command.

rclone v1.58.0
- os/version: ubuntu 22.04 (64 bit)
- os/kernel: 5.15.0-37-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.17.8
- go/linking: static
- go/tags: none

Which cloud storage system are you using? (eg Google Drive)

Google drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

/usr/bin/rclone sync \
    --update \
    --fast-list \
    --transfers 30 \
    --checkers 120 \
    --contimeout 60s \
    --timeout 300s \
    --retries 3 \
    --low-level-retries 10 \
    --stats 1s \
    --skip-links \
    --log-level INFO \
    --delete-before \
    --delete-excluded "/home/alandefreitas/Pictures" "remote:Pictures" \
    --exclude "venv/**" \
    --exclude "Screenshots/**" \
    --exclude ".idea/**" \
    --exclude "Albums/**" \
    --exclude "Photos/.dtrash/**" \
    --exclude "**/*.db" \
    --exclude "*.db" \
    --exclude ".DS_Store" \
    --exclude "._.DS_Store" \
    --exclude "**/_MACOSX/**" \
    --exclude "_MACOSX/**" \
    --config /home/alandefreitas/.config/rclone/rclone.conf

The rclone config contents with secrets removed.

[remote]
type = drive
client_id = *******************
client_secret = *******************
scope = drive
token = *********
team_drive = 

A log from the command with the -vv flag

This question is not about a bug. There's nothing different at all with the output in this question. rclone syncs the files perfectly, deleting Albums, as it should. I just don't know if there's a command to tell rclone not to do that.

If you exclude the Albums directory from the sync it will be excluded from deletion also as well as excluded from copying unless you are using the --delete-excluded flag which you are...

So removing that will help.

Note also --exclude "Albums/**" excludes an Albums directory anywhere in the file heirachy, not just in the root - you probably want --exclude "/Albums/**" to exclude it just at the root.