rclone: rclone copy --metadata not working for folders
The associated forum post URL from https://forum.rclone.org
What is the problem you are having with rclone?
I did sudo rclone copy --metadata <src> <dest> as root user
To validate the dest content, I did the restore using same rclone cmdline interchanging src and dest as root user.
While the files get the right attributes (permission level, owner, group), the folder has got root:root and restore date.
What is your rclone version (output from rclone version)
rclone v1.61.1
- os/version: oracle 7.9 (64 bit)
- os/kernel: 5.4.17-2136.314.6.2.el7uek.x86_64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.19.4
- go/linking: static
- go/tags: none
Which OS you are using and how many bits (e.g. Windows 7, 64 bit)
Oracle Linux Server release 7.9
Which cloud storage system are you using? (e.g. Google Drive)
Oracle Cloud Infrastructure
The command you were trying to run (e.g. rclone copy /tmp remote:tmp)
sudo rclone copy --metadata <src> <dest>
A log from the command with the -vv flag (e.g. output from rclone -vv copy /tmp remote:tmp)
How to use GitHub
- Please use the š reaction to show that you are affected by the same issue.
- Please donāt comment if you have no relevant information to add. Itās just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 9
- Comments: 15 (4 by maintainers)
Iām willing to pledge $100 for full metadata preservation*. Unfortunately I donāt have the clout to get my employer to sponsor it (I donāt think they use rclone). @ncw do you use something like Bountysource?
* by full metadata what I mean is that
should have the exact same result as
where A and B are both linux systems.
I would also accept non-preservation of hardlinks (i.e., rsync without the
-Hoption). But directory mtime and permissions are a must!This is for my own usage. Unfortunately Iām not a rich man, have zero Golang experience and not much free time. If there is some sort of crowdfunding/bounty setup Iād be willing to chip in up to say $200.
Iām currently thinking about metadata for directories.
The problem with this idea is that directories donāt support
SetModTimeat the moment. This is something which will need to be added to backends to support it.That is my ultimate plan š
It is a very useful thing. However it is not at all a straight forward bit of work since the assumption that rclone can create and destroy directories whenever it wants is baked into every backend.
Some backends will need the modtime of directories updating if you write files in them, but I imagine some wonāt.
I had a quick thought about this. Would it be of interest if I could write a small command that copies dir modtimes from one remote to another (for backends that support it)? It would be intended as more of a short-term stop-gap to tide us over while we wait hopefully for full dir metadata support, which would be a much more complicated project.
Many backends (including
localanddrive) already support listing directory modtime, like:So the command Iām imagining would do basically the equivalent of the above command, then loop through all the results and do something like
err = dir.SetModTime(ctx, t)for each corresponding dir on the dest. (Probably with a--modify-windowcheck first, and maybe also support for--update.)An alternate approach might be to tack it on to the end of
copy/syncas an optional extra step, very much like--create-empty-src-dirs.My use case is that my Google Drive currently has all the correct modtimes of my folders, and when I use rclone to
syncthem to a new computer, I want to be able to follow that with a command to copy over all the folder modtimes fromdrivetolocal. Modtime is the main piece of dir metadata I care about (especially because of macOS āpackagesā which are really dirs), so in my opinion, a command like this would deliver a lot of value for relatively little effort.Is this something youād want?
Iām added simple example add metadata for local backend https://github.com/rclone/rclone/compare/master...lxShaDoWxl:rclone:master
Yes, but not for folders, so in the example above rclone and rsync would give different outputs.