Rclone not creating empty folders / directories

Rclone not creating empty folders / directories.

This is important to us because we create empty directories which are used randomly as needed by software products on the server. If they are not there, the software fails.

Is this a flaw or if known, is there any plan to incorporate these ?

Here is an example of the rclone command we are using where this behavior is present:
rclone copy --log-file /CM/data-drive/logs/backup-offsite.log --config /CM/data-drive/cm_backups/offsite/rclone.conf /CM/data-drive data-drive:$bucket_id

Thanks.

Jay

It is a known issue. The only real work around is to touch files in those directories prior to copy and then delete them after.

2 Likes

Thanks Calisro.

I feel you might be misunderstanding the question. My goal is to create them not delete them. So I am uncertain about your last line to “delete them after”.

Your thoughts.

Jay

What I was saying is that rclone won’t create EMPTY directories in the destination. It only creates files which implicately then create the directories those files are contained in.

My suggestion was to touch files in the empty directories locally before syncing, then remove those files that you created. Like this in bash:

find $DIR -type d -empty -exec touch {}/deleteme.txt ;
rclone sync
find $DIR -type f -name deleteme.txt -exec rm {} ;

2 Likes

Ah - That cleared it up. Good potential work around. I’ll create a bash script that puts an empty file in all directories prior to running. That’s a good work around.

Thanks for the thought.

Jay

May nee to tweak that a little. There may be issues with zero bytes files. I’d change that bash script to put small files (maybe echo > deleteme.txt) rather than a zero byte. I just looking at my script…

Can you make a please make a new issue on github about this please. I thought I had fixed this recently, but obviously not :wink:

1 Like

Hello people!
Because I’m syncing a local folder on OneDrive, I’ve found that remotely empty folders are not created.
Is this issue fixed?

Regards,
ghale

Try the latest beta - we've been working on this - it may not work yet though, if not please make a new issue on github.

Tried and not working.
I’ve opened a new issue, attaching a logfile.

I’m available for tests, of course.

BTW: thanks for reply!

Hi~

Do you have a similar script for windows?

Without the empty folders, cryptomator (encryption for cloud) don’t work.

This ruin my idea to backup the encrypted files to the cloud.

Thank you.

BTW here is the issue: https://github.com/ncw/rclone/issues/1837

It is on the do soon list!

1 Like

Will some body know if I rclone check -c source target,

will “rclone check” ignore empty folders or not?

does it ensure same FILE AND FOLDERS?

thanks.

btw, I will verify myself later and report here too.

Thanks

No, rclone check only checks files not directories.

If you wanted to check all the directories were there you could do something like

rclone lsf --dirs-only -R source:path | sort > source.dirs
rclone lsf --dirs-only -R dest:path | sort > dest.dirs
diff -u source.dirs dest.dirs
1 Like

but for every run of rclone check,

if i eliminate any empty folder beforehand by filling in dummyfiles
with the previous script,

every run of rclone check -c will ensure all files AND folders are there right?

thx

Yes, if you have no empty folders, then rclone check will make sure all the files are there, which implies all the folders are there too.