Skip to content

Read-only files not deletable on Windows #1610

Closed

Description

@avdv

I was syncing some files from a Linux machine to the Windows 8 host, then deleted some of those files again.

The log on the Windows machine turned up these errors:

[GUEL3] 22:27:05 INFO: Puller (folder "Photos", file "2012\\08\\04\\124620.jpeg")
: delete: remove C:\Users\Fred\Photos\2012\08\04\124620.jpeg: access denied
[GUEL3] 22:27:05 INFO: Puller (folder "Photos", file "2012\\08\\04\\124628.jpeg")
: delete: remove C:\Users\Fred\Photos\2012\08\04\124628.jpeg: access denied
[GUEL3] 22:27:05 WARNING: Folder "Photos" isn't making progress - check logs for
possible root cause. Pausing puller for 1m0s.

I could delete those files manually using the Windows explorer, but trying to run del in a cmd window gave an error too:

> del C:\Users\Fred\Photos\2012\08\04\124628.jpeg
C:\Users\Fred\Photos\2012\08\04\124628.jpeg
Access is denied.

Turns out, that on Windows, you cannot simply delete files having the READONLY flag set. See the discussion here: golang/go#9606

Basically, you would have to remove the read-only attribute prior to trying call os.remove.

Activity

  1. AudriusButkevicius commented on Apr 8, 2015

    @AudriusButkevicius
    Member

    Right, and what's the bug?

  2. AudriusButkevicius commented on Apr 8, 2015

    @AudriusButkevicius
    Member

    Actually, I now understand.
    It's weird that this actually happens.

  3. added
    bug
    on Apr 8, 2015
  4. added 3 commits that reference this issue on Apr 16, 2015
    c2ad58c
    301be66
    dff51fc
  5. added a commit that references this issue on Apr 17, 2015
    da8a1f2
  6. meztup commented on Nov 19, 2016

    @meztup

    This issue still occurs for folders with the read-only attribute set. This is usually not an issue, but Windows sets this attribute on folders automatically when you set a custom icon for said folder. In those cases, a delete of the folder on one host results in "out of sync" on the other until one manually deletes the folder on the "out of sync" side.

  7. added
    frozen-due-to-age
    on Jun 16, 2017
  8. locked and limited conversation to collaborators on Jun 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfrozen-due-to-age

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions