Syncing files, but keeping empty directories

What is the problem you are having with rclone?

I am syncing from S3 to a local server. I would like to only sync the files and not directories. By default, rclone removes any directories in the destination that are not in the source. However, I would like to keep the empty directories on the destination while still removing files that are not on the source. I am not sure if there is a flag, or if I need to use a command other than sync.

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

v1.53.3-DEV

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

S3 (Ceph)

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

rclone sync --config /etc/rclone/rclone.conf ceph-dc1:/src /dest

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

I don't have the latest rclone (I'm installing it through Ubuntu 24.04 repo). Here is the config that I redacted myself.

[ceph-dc1]
type = s3
provider = Ceph
access_key_id = XXX
secret_access_key = XXX
endpoint = XXX

[ceph-dc2]
type = s3
provider = Ceph
access_key_id = XXX
secret_access_key = XXX
endpoint = XXX

A log from the command that you were trying to run with the -vv flag

There are no error logs. Rclone is working as intended by default. I'm looking to see if there's other options that fit my need.

# N/A

Please... this is an ancient version. No point to recommend anything as who knows what was or not implemented many years ago. This is rclone from 2020...

I do not think you can do what you want with single rclone command but you could run:

rclone lsf -R source:| sort > source-sorted
rclone lsf -R dest:| sort > dest-sorted
comm -23 source-sorted dest-sorted > to-transfer
comm -13 source-sorted dest-sorted > to-delete
rclone copy --files-from to-transfer --no-traverse source: dest:
rclone delete --files-from to-delete --no-traverse dest: