Skip to content

BUG: MemoryFS.move fails to change filename. #522

@tfeldmann

Description

@tfeldmann

I've got some strange behavior that I cannot explain.

I'm creating a file Old-name.txt on a MemoryFS, then moving it to a new location under a new name.
Problem is it still has the old name.

Testcase:

import fs
from fs.move import move_file


with fs.open_fs("mem://") as mem:
    old = mem.makedir("Old")
    new = mem.makedir("New")

    old.writetext("Old-name.txt", "Some content")

    print("Before:")
    mem.tree()

    move_file(
        src_fs=mem,
        src_path="Old/Old-name.txt",
        dst_fs=mem,
        dst_path="New/New-name.txt",
    )

    print("After: (Still the old name)")
    mem.tree()

Output:

Before:
├── New
└── Old
    └── Old-name.txt
After: (Still the old name)
├── New
│   └── Old-name.txt
└── Old

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions