125
Views
3
Comments
Solved
[FileSystem] Rename File (Filesystem)
filesystem
Service icon
Forge asset by João Portela
Application Type
Traditional Web
Service Studio Version
11.10.1 (Build 35287)
Platform Version
11.10.1 (Build 23852)

Is there any way to rename a file without having to create a new file and delete the old file? It seems like Filesystem should handle this, but I don't see a rename action is Filesystem. 

Thanks

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

Hi Junfeng,

There is no explicit rename file command in .NET/C#, so that's why FileSystem lacks it. Unfortunately, the canonical way, using File_Move, doesn't work, as DestinationDirectoryPath cannot contain a file name. I'll see if I can add a File_Rename to FileSystem so renameing a file is possible.

EDIT: I didn't look right, and in fact you can use File_Move to rename a file. To do so, make sure DestinationDirectoryPath contains the same path as Path, and specify a different file name. I'll update the documentation to explicitly mention using File_Move for renaming a file.

2023-10-17 06-43-50
lu junfeng

i have a same question

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

Hi Junfeng,

There is no explicit rename file command in .NET/C#, so that's why FileSystem lacks it. Unfortunately, the canonical way, using File_Move, doesn't work, as DestinationDirectoryPath cannot contain a file name. I'll see if I can add a File_Rename to FileSystem so renameing a file is possible.

EDIT: I didn't look right, and in fact you can use File_Move to rename a file. To do so, make sure DestinationDirectoryPath contains the same path as Path, and specify a different file name. I'll update the documentation to explicitly mention using File_Move for renaming a file.

2023-10-17 06-43-50
lu junfeng

Hi Kilian Hekhuis

Many Thanks , Now i get it.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.