-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rclone copy creating empty directories it didn't create before #7689
Comments
I'm on macOS 14.3.1 running rclone v1.66.0 and I am experiencing the same issue. Folders are now being copied/synchronized, and at the destination, they are empty. They are empty because the folders do not contain files match the extension I have specified in the include flag on the rclone command line. rclone v1.66.0
OS used: macOS 14.3.1. Remote is SSH/SFTP. Command line used: Results of the command with dry-run:
|
I'm not 100% sure if this is related, but |
Hi @sabitm, As for the original issue -- FYI there is an ongoing discussion about it in the forum: |
Hi @nielash, thanks for maintaining I'm not entirely sure how to debug though. It happens randomly enough. I'll try to find a way to reproduce it and will opening an issue if I found something interesting. |
There are several threads about this on the forum
For rclone v1.66.1 I am going to make sure it obeys the What the defaults for this for |
Thank you @ncw for confirming the bug. Additionally, I have a small issue that I won't open a separate issue for. root@localhost:~/TEST# tree
.
├── ABC
└── D EF
2 directories, 0 files
root@localhost:~/TEST# rclone copy D
D If we use the old version of rclone to create a completion script and apply it, we can also complete paths normally in 1.66. root@localhost:~/TEST# rclone-v1.65.2-linux-amd64/rclone completion bash
root@localhost:~/TEST# . /etc/bash_completion
root@localhost:~/TEST# rclone version
rclone v1.66.0
- os/version: debian 10.0 (64 bit)
- os/kernel: 5.14.9 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.22.1
- go/linking: static
- go/tags: none
root@localhost:~/TEST# rclone copy D\ EF/ |
I can confirm that. Can you open a new issue about this please? So we don't mix the two up - thank you. (BTW I think this is a bug in cobra and here is the fix spf13/cobra#2126 - Note also that if you type a |
…false In v1.66.0 the changes to enable metadata preservation on directories introduced a regression, namely that empty directories were created despite the state of the --create-empty-src-dirs flag. This patch fixes the problem by letting the normal rclone directory creation create the directories and fixing up their timestamps and metadata afterwards if --create-empty-src-dirs=false. Fixes #7689 See: https://forum.rclone.org/t/empty-dirs-not-wanted/45059/ See: https://forum.rclone.org/t/how-to-ignore-empty-directories-when-uploading-from-windows/45057/
…false In v1.66.0 the changes to enable metadata preservation on directories introduced a regression, namely that empty directories were created despite the state of the --create-empty-src-dirs flag. This patch fixes the problem by letting the normal rclone directory creation create the directories and fixing up their timestamps and metadata afterwards if --create-empty-src-dirs=false. Fixes #7689 See: https://forum.rclone.org/t/empty-dirs-not-wanted/45059/ See: https://forum.rclone.org/t/how-to-ignore-empty-directories-when-uploading-from-windows/45057/
Here is a first attempt at a fix - this obeys v1.67.0-beta.7854.8d02ad3ba.fix-7689-empty-dirs on branch fix-7689-empty-dirs (uploaded in 15-30 mins) @nielash I've been unable to get the bisync tests to pass on Windows or macOS. I have no idea why they are failing. Running with -golden sorted out the linux tests but not Windows or macOS. Can you help? Also any code review gratefully received :-) |
It looks to me like the issue is that
and
This comment seems potentially relevant: Lines 1494 to 1497 in 05e5712
I can take a closer look later! |
…false In v1.66.0 the changes to enable metadata preservation on directories introduced a regression, namely that empty directories were created despite the state of the --create-empty-src-dirs flag. This patch fixes the problem by letting the normal rclone directory creation create the directories and fixing up their timestamps and metadata afterwards if --create-empty-src-dirs=false. Fixes #7689 See: https://forum.rclone.org/t/empty-dirs-not-wanted/45059/ See: https://forum.rclone.org/t/how-to-ignore-empty-directories-when-uploading-from-windows/45057/
@ncw I'm doing the closer look at fix-7689-empty-dirs now and I think there's an issue with the The same test would have passed previously. |
@ncw added a few other inline comments: and a test that (I think) catches another regression: nielash@cd0891d |
…false In v1.66.0 the changes to enable metadata preservation on directories introduced a regression, namely that empty directories were created despite the state of the --create-empty-src-dirs flag. This patch fixes the problem by letting the normal rclone directory creation create the directories and fixing up their timestamps and metadata afterwards if --create-empty-src-dirs=false. Fixes #7689 See: https://forum.rclone.org/t/empty-dirs-not-wanted/45059/ See: https://forum.rclone.org/t/how-to-ignore-empty-directories-when-uploading-from-windows/45057/
I finally got round to fixing up this code. Can you take a quick look @nielash ? I think it is doing the right thing now. I left the fixes unsquashed so you can see them and I put your tests in (though I took one line out as I don't think it was correct any more). v1.67.0-beta.7901.7042810e8.fix-7689-empty-dirs on branch fix-7689-empty-dirs (uploaded in 15-30 mins) Thank you :-) |
@ncw I think it mostly looks good, but the issue I mentioned here is still not fixed. Here's a test that demonstrates it: nielash@d670d07 (same test would have passed previously) ...which passes once this is reverted: nielash@ff4198d Otherwise I think it looks good! |
…false In v1.66.0 the changes to enable metadata preservation on directories introduced a regression, namely that empty directories were created despite the state of the --create-empty-src-dirs flag. This patch fixes the problem by letting the normal rclone directory creation create the directories and fixing up their timestamps and metadata afterwards if --create-empty-src-dirs=false. Fixes #7689 See: https://forum.rclone.org/t/empty-dirs-not-wanted/45059/ See: https://forum.rclone.org/t/how-to-ignore-empty-directories-when-uploading-from-windows/45057/
Thanks for the review @nielash This feels like the never ending bug! I've fixed the issue that you pointed out (I realize I misunderstood the purpose of Please take another look! I also fixed a bug pointed out in the forum https://forum.rclone.org/t/empty-dirs-not-wanted/45059/14 Hopefully if this checks out I'll squash it down, neaten it up and then that is the last bit needed for v1.66.1 v1.67.0-beta.7906.91d78fd38.fix-7689-empty-dirs on branch fix-7689-empty-dirs (uploaded in 15-30 mins) |
Added a comment for you inline. This is a tricky one indeed! |
@nielash I can't find your comment! I thought I saw a notification but it has gone! Please post a link - thank you :-) |
@ncw here you go! 91d78fd#r141149941 |
…false In v1.66.0 the changes to enable metadata preservation on directories introduced a regression, namely that empty directories were created despite the state of the --create-empty-src-dirs flag. This patch fixes the problem by letting the normal rclone directory creation create the directories and fixing up their timestamps and metadata afterwards if --create-empty-src-dirs=false. Fixes #7689 See: https://forum.rclone.org/t/empty-dirs-not-wanted/45059/ See: https://forum.rclone.org/t/how-to-ignore-empty-directories-when-uploading-from-windows/45057/
…false In v1.66.0 the changes to enable metadata preservation on directories introduced a regression, namely that empty directories were created despite the state of the --create-empty-src-dirs flag. This patch fixes the problem by letting the normal rclone directory creation create the directories and fixing up their timestamps and metadata afterwards if --create-empty-src-dirs=false. Fixes #7689 See: https://forum.rclone.org/t/empty-dirs-not-wanted/45059/ See: https://forum.rclone.org/t/how-to-ignore-empty-directories-when-uploading-from-windows/45057/
I've merged this to master now which means it will be in the latest beta in 15-30 minutes and released in v1.66.1 Thanks for all your help @nielash :-) |
…false In v1.66.0 the changes to enable metadata preservation on directories introduced a regression, namely that empty directories were created despite the state of the --create-empty-src-dirs flag. This patch fixes the problem by letting the normal rclone directory creation create the directories and fixing up their timestamps and metadata afterwards if --create-empty-src-dirs=false. Fixes rclone#7689 See: https://forum.rclone.org/t/empty-dirs-not-wanted/45059/ See: https://forum.rclone.org/t/how-to-ignore-empty-directories-when-uploading-from-windows/45057/
What is the problem you are having with rclone?
Rclone will now sync directory modification times if the backend supports it
That's a cool new feature, but I think it shouldn't be enabled by default, or it should ignore folders by default where no files need to be transferred.
In the previous version, I could simply
copy
to the remote within the folder where I needed to upload files, but now I have to remove the other folders in that folder that have no files first, otherwise these empty folders will also be created on the remote due to the sync modification time.Conversely, if I only need to copy specific files from the remote to the local (using
--include
), but other irrelevant folders under that path on the remote will also be created on my local machine with the original structure. This did not exist in previous versions and is a bit annoying.What is your rclone version (output from
rclone version
)rclone v1.66.0
Which OS you are using and how many bits (e.g. Windows 7, 64 bit)
The information has already been mentioned above.
Which cloud storage system are you using? (e.g. Google Drive)
This is not related to a specific backend.
The command you were trying to run (e.g.
rclone copy /tmp remote:tmp
)rclone copy -vv Source Remote --include E.txt
A log from the command with the
-vv
flag (e.g. output fromrclone -vv copy /tmp remote:tmp
)How to use GitHub
The text was updated successfully, but these errors were encountered: