Skip to content

Manage folders #100

Closed
Closed

Description

@ncw

Some of rclones remote fs do understand the concept of folders, eg

  • drive
  • local
  • dropbox

Make an optional interfaces (eg Mkdir, Rmdir) for these FS to manage the creation and deletion of folders. This would enable empty folders, and deletion of empty folders on sync.

Activity

  1. mullenkamp commented on Aug 26, 2015

    @mullenkamp

    I just noticed this issue when I sync to drive. I would definitely like to have folders deleted in addition to the contained files.
    Thanks a lot for the copy program, it's the most reliable I've used so far for google drive.

  2. ncw commented on Aug 26, 2015

    @ncw
    MemberAuthor

    @mullenkamp thanks for the vote of confidence! I can see a plan coming together for this.

  3. austinginder commented on Sep 11, 2015

    @austinginder

    Been using Rclone regularly for the past few months. Works solid. There are a good number of empty directories left in my Dropbox. This would be awesome if it was built in with the sync command.

  4. memeplex commented on Dec 28, 2015

    @memeplex

    This is specially important for synchronizing databases (for example, a git repo) which may:

    1. require an empty directory to be there.
    2. leave behind a large number of empty directories.
  5. Wowfunhappy commented on Feb 3, 2016

    @Wowfunhappy

    Is there any chance that this will be prioritized in the near-ish future?

    The longer that I use rclone to sync the contents of my local hard drive with ACD, the more of a problem this is becoming. As files naturally get reorganized and moved around, more and more empty folders pile up on ACD. An aesthetic problem, perhaps, but it's becoming difficult to actually find the files I want, and there's no way to programmatically find and delete the empty folders short of completely deleting the remote copy and re-uploading from scratch, which would take literal months over my internet connection.

    Rclone is still useful for creating remote backups should my local hard drive fail, but it's a lot less useful than it once was.

  6. ncw commented on Feb 10, 2016

    @ncw
    MemberAuthor

    I think what I might do for this is just delete empty folders on the destination at the end of the sync.

    This is relatively straight forward and will satisfy nearly all cases, except for that of syncing an empty directory.

  7. added this to the Soon milestone on Feb 10, 2016
  8. cento79 commented on Feb 10, 2016

    @cento79

    I think it'll be a useful workaround. I'd go for a dedicated switch to enable the deletion so that people actually wanting empty folders will not be affected. BTW, great job: I synced almost 700GB in less that 3 days; I used to use rsync before and it kept crashing every few GBs. Excellent tool.

  9. dav1303 commented on Feb 10, 2016

    @dav1303

    Sure adding a parameter to let user choose what he wants to do

    • Delete empty folders or not delete
  10. Wowfunhappy commented on Feb 10, 2016

    @Wowfunhappy

    Deleting empty folders would definitely solve the problem for my use case.

  11. mcrisc commented on Feb 16, 2016

    @mcrisc

    I agree with @cento79: a switch to enable deletion would be a good solution. Started using rclone a few days ago. Good tool! Congrats!

  12. winternet-studio commented on Apr 7, 2016

    @winternet-studio

    I definitely also vote for a switch to enable folder deletion.

  13. calisro commented on Apr 21, 2016

    @calisro
    Member

    I am for folder deletion but I would rather see rclone delete a folder when asked to rather than delete the contents of a directory and then the empty directory. The reason that I have for this:

    In my use case, I use Amazon Cloud Drive to store home camera data (videos/jpgs) from my home's automation. I store everything in directories sort of like this:

    /cams//2016-02-01
    /cams//2016-02-02
    /cams//2016-02-03
    /cams//2016-02-04
    /cams//2016-02-05

    etc. So daily folders for each camera. In the GUI, when I send a folder to the trash, it literally sends the folder to the trash and if I were to try to purge that folder or even restore that folder it would be VERY simply to do. i.e. select the folder and restore/delete depending on my wishes.

    IF I perform the deletes via RCLONE, It deletes and puts in the trash up with tens of thousands of individual files contained in those folders. Good luck trying to restore them when they are all intermixed with different days/cameras. and there is no method available in amazon cloud drive to 'purge trash' (It needs to be done in batches of 1000 and takes a long time via the GUI).

    It would be more efficient to have rclone delete the contents or folder depending on what you specify. Like this:

    This could delete individual files
    rclone -delete robacd:/cams/playroom/2016-03-29/*
    OR
    rclone -delete robacd:/cams/playroom/2016-03-29/

    This could delete the FOLDER itself (no trailing slash and/or no star)
    rclone -delete robacd:/cams/playroom/2016-03-29

    Thanks for the great tool.

  14. Wowfunhappy commented on Apr 23, 2016

    @Wowfunhappy

    Perhaps this should be split into two separate tickets? I think that properly managing folders is clearly the ideal long-term goal, but it would be great if rclone could simply delete empty folders in the interim.

  15. 63 remaining items

  16. netinial commented on Sep 18, 2017

    @netinial

    I confirm that there are still same issue for GDrive, (leaving empty folders.)

  17. winternet-studio commented on Sep 20, 2017

    @winternet-studio

    If anyone is interested in a PHP script that will ensure an exact copy by removing folders on the destination that no longer exist in the source I have posted one here: #1642 (comment)

  18. adrianog commented on Dec 11, 2017

    @adrianog

    @ncw why is this the case: "provided there were no IO errors"?

    Should we not (attempt to) remove directories from destination regardless, if they are not in the source, irrespective of previous IO errors?

  19. ncw commented on Dec 12, 2017

    @ncw
    MemberAuthor

    @adrianog "IO errors" can mean the source was read wrong. If you read an empty directory incorrectly in the source, you don't want to delete stuff in the destination. The same logic doesn't quite apply for source directories, but I'd like to keep the logic the same, as in "IO errors" mean no deletions.

  20. archon810 commented on Aug 3, 2019

    @archon810
  21. ncw commented on Aug 4, 2019

    @ncw
    MemberAuthor

    https://rclone.org/bugs/ refers to this ticket and should probably be updated.

    Well spotted! I haven't looked at that bugs page for years!

  22. trademark18 commented on Nov 6, 2020

    @trademark18

    Is there a workaround for this? In my use case I recursively process files in each directory, then when it's empty, I'd like to delete the "folder" on IBM COS. I've tried various versions of rmdirs or rmdir and nothing at all seems to delete that "folder" on the ICOS console. Any info on how to run a command to delete the "folder" on ICOS would be appreciated.

  23. ncw commented on Nov 6, 2020

    @ncw
    MemberAuthor

    Is there a workaround for this? In my use case I recursively process files in each directory, then when it's empty, I'd like to delete the "folder" on IBM COS. I've tried various versions of rmdirs or rmdir and nothing at all seems to delete that "folder" on the ICOS console. Any info on how to run a command to delete the "folder" on ICOS would be appreciated.

    I suspect that there is a 0 sized directory marker object that rclone is ignoring.

    You should find that rclone purge icos:bucket/path/to/folder will remove it. However be careful with purge - it really will delete everything!

  24. trademark18 commented on Nov 6, 2020

    @trademark18

    @ncw Thanks for the tip. I tried it and sadly I got the same result. Oddly I'm not having this issue on a "Standard" bucket, but only on "Smart Tier" buckets. Maybe those are different under the hood?

  25. ncw commented on Nov 9, 2020

    @ncw
    MemberAuthor

    @ncw Thanks for the tip. I tried it and sadly I got the same result. Oddly I'm not having this issue on a "Standard" bucket, but only on "Smart Tier" buckets. Maybe those are different under the hood?

    I remembered wrong - sorry! The S3 backend doesn't support Purge. I suspect this directory was created with something other than rclone - is that correct?

  26. trademark18 commented on Nov 16, 2020

    @trademark18

    @ncw Yes, the directories were created by an Aspera upload.

  27. ncw commented on Nov 16, 2020

    @ncw
    MemberAuthor

    @ncw Yes, the directories were created by an Aspera upload.

    What will have happened is that "directory markers" have been created. These are empty files with names like dir/. Rclone doesn't deal with these properly at the moment.

    If you would like to make a new issue @trademark18 then we can get rclone purge to remove them fairly easily which would be a step forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions