Skip to content

MoveTo does not work as expected #1678

@fijsh

Description

@fijsh

I'm trying to move file abc.txt to a different folder and file name using the following code:

var files = client.ListDirectory("MyFiles/In").ToList();

foreach (var file in files.Where(f => f.IsRegularFile)) {
	var newFilePath = $"MyFiles/In/archive/{DateTime.Now:yyyyMMddHHmmss}-{file.Name}";
	file.MoveTo(newFilePath);
}

When the source file name abc.txt already exists in the archive sub folder the library throws an exception with message Already exists even though the target file name will have a different name (prefixed with a date time stamp).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions