No verbose NOTICE message when creating empty directories

What is the problem you are having with rclone?

When using rsync -v -n sync --create-empty-src-dirs I'm told that an empty directory would've been created:

~% rclone -v -n sync --create-empty-src-dirs nc:foo bar -n
<5>NOTICE: dir1: Skipped make directory as --dry-run is set
<6>INFO  : There was nothing to transfer
<5>NOTICE:
Transferred:              0 B / 0 B, -, 0 B/s, ETA -
Checks:                 1 / 1, 100%
Elapsed time:         1.9s

However, when removing the -n flag, the empty directory is created but I'm no longer told about it:

~% ls bar
~% rclone -v sync --create-empty-src-dirs nc:foo bar
<6>INFO  : There was nothing to transfer
<6>INFO  :
Transferred:              0 B / 0 B, -, 0 B/s, ETA -
Checks:                 1 / 1, 100%
Elapsed time:         2.4s
~% ls bar
dir1
~%

I was reporting this bug on GitHub already, however, the issue was closed with the comment that "rclone works on files generally so a directory won't show up as that's expected". I was also asked to post any further questions over here on the forum.

While I do understand the comment from above, it is the inconsistency of the NOTICE messages being shown with or without the --dry-run flag that I was reporting in the bug report. In other words, if rclone doesn't work on files then it shouldn't show the Skipped make directory NOTICE message when using the --dry-run flag, just as much as that message isn't shown when not using the --dry-run flag.

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

v1.62.2

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

OneDrive

A log from the command with the -vv flag

~% rclone -vv sync --create-empty-src-dirs nc:foo bar
<7>DEBUG : rclone: Version "v1.62.2" starting with parameters ["rclone" "-vv" "sync" "--create-empty-src-dirs" "nc:foo" "bar"]
<7>DEBUG : rclone: systemd logging support activated
<7>DEBUG : Creating backend with remote "nc:foo"
<7>DEBUG : Using config file from "/home/user1/.config/rclone/rclone.conf"
<7>DEBUG : found headers:
<7>DEBUG : Creating backend with remote "bar"
<7>DEBUG : Local file system at bar: Waiting for checks to finish
<7>DEBUG : Local file system at bar: Waiting for transfers to finish
<7>DEBUG : dir1: Making directory
<7>DEBUG : Local file system at bar: copied 1 directories
<7>DEBUG : Waiting for deletions to finish
<6>INFO  : There was nothing to transfer
<6>INFO  :
Transferred:              0 B / 0 B, -, 0 B/s, ETA -
Checks:                 1 / 1, 100%
Elapsed time:         2.3s

Yes. Good catch.

I think it is how it is now - could be improved for sure - should be easy change.

PRs welcomed from anybody interested in fixing it.

If it is something you really need you should give it a go:) and fix it.

Would you agree though that it should show the make directory NOTICE message consistently since the --create-empty-src-dirs flag was provided, thus telling rclone explicitly not to work on files only but also on empty directories?

Sorry but I've never worked with Go. Thus, I'd be thankful if someone else was to fix this.

Yes I agree it would be nice too be logged during normal operations.

Rclone could log all the empty directories it creates - that would be fairly easy.

However the non empty directories created as part of the sync would not be logged. For efficiency with the bucket based backends rclone expects the backend to create intermediate directories when uploading a file. This means each backend would have to log directory creation which is a lot of work to make consistent.

So is it worth doing if it only logs creation of empty directories?

That is totally fine if the creation of non-empty directories is not logged. In the end the --create-empty-src-dirs flag is talking about empty directories, not non-empty directories. Thus, if the flag was provided I would only expect to be told about the creation of empty directories, not non-empty directories.

As noted in my first post, rclone is already behaving as expected when providing the --dry-run flag. The only thing missing is to make this behaviour consistent with an rclone invocation without the --dry-run flag.

Anyone keen to implement this?

Reopening the bug report might be another option if others, such as @ncw, deem it plausible to do so to fix this inconsistency. Thoughts?

BTW - if you need to capture information about creation of empty directories in your sync operation set --log-level DEBUG

Thanks, I'm aware of that. However, the issue being reported here is the inconsistency that the -n flag is already showing a make directory message without setting the logging level to DEBUG. Thus, setting the logging level to DEBUG shouldn't be required either when the -n flag is not provided.

I believe this is part of code generating this info:

There are probably tones of imperfections like this in rclone. It is now listed here so anybody happy to improve rclone can have a go (pun intended):slight_smile:

If you consider it important you have to implement it, sponsor or find someone to do it. Or wait... because it is cosmetic issue and not everybody thinks that is important.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.