question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

rclonesync does not sync empty directories

See original GitHub issue

When syncing a local directory with a (Google Drive) remote, empty directories that exist either on Path1 or Path2 are not being created on the other. While for “end user files” this behavior might be acceptable, especially folder structures that belong to programs might expect empty directories to be in place.

Edit: Adding --rclone-args --create-empty-src-dirs as last parameter unfortunately does not solve the issue, as --create-empty-src-dirs is not a global rclone parameter. This results in rclone lsl returning an error.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
cjnazcommented, Sep 25, 2020

This sequence may get you close to what you need

1) rclonesync <path1> <path2>
2) rclone copy <path1> <path2> --filter "+ */" --filter "- **" --create-empty-src-dirs
3) rclone copy <path2> <path1> --filter "+ */" --filter "- **" --create-empty-src-dirs

The filtering in line 2 first includes all directories in path1, and then excludes everything else in path1. The empty directories in path1 are created on path2. The filtering on line 3 does the same for path2 to path1.

The limitation is that empty directories only accumulate, and must be manually deleted on both sides. You could use rlconesync’s --remove-empty-directories switch to clean them out of both paths, or rclone’s rmdirs command.

1reaction
cjnazcommented, Mar 15, 2022

Did you try the --remove-empty-directories switch?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Force rclone to sync empty directories to Google Drive ...
Hi, I have a backupscript (using rclone sync) backing up to Google Drive ... that empty directories/folders does not get copied/created.
Read more >
rsync - Synchronize content of two buckets/directories
Note 3: rsync does not copy empty directory trees, since Cloud Storage uses a flat namespace. Using -d Option (With Caution!) To Mirror...
Read more >
Ubuntu Manpage: Rclone - syncs your files to cloud storage
It is always the contents of the directory that is synced, not the directory so when source:path is a directory, it's the contents...
Read more >
Transferring Files Using rclone
Rclone allows users to copy or sync files from local storage to a cloud storage ... Please note that rclone transfers may be...
Read more >
Download file from the shared folder of Google Drive by using ...
The line Configure this as a Shared Drive (Team Drive)?. Then the sync would be: rclone sync SharedDriveName:"Directory/Directory" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found