File renamer
Last updated
Last updated
[io/file/File renamer]
Renames a file specified by the path in source path
to the new file name in new name
.
Example (success):
"home/user1/foo.txt"@0 received on source path
"bar.txt"@0 received on new name
{
source: "/home/user1/dir1/foo.txt",
destination: "/home/user1/dir1/bar.txt"
}@ sent on renamed
Example (failure):
"/home/user1/foo.txt"@0 received on source path
"bar.txt"@0 received on new name
{
source: "/home/user1/dir1/foo.txt",
destination: "/home/user1/dir1/bar.txt"
}@0 sent on bounced
{
"error": "Error: ENOENT: no such file or directory, rename '/home/user1/dir1/foo.txt' -> '/home/user2/dir1/bar.txt'"
}@0 sent on error
source path: string
Receives the path of the file to rename. Example: "/home/user1/dir1/foo.txt" (To keep the application portable use "/" as path separator.)
new name: string
Receives the desired new file name. Example: "bar.txt"
bounced: any
Sends synced parameters if operation has failed. Example: { source: "/home/user1/dir1/foo.txt", destination: "/home/user1/dir1/bar.txt" }
renamed: any
Sends synced parameters if operation has succeeded. Example: { source: "/home/user1/dir1/foo.txt", destination: "/home/user1/dir1/bar.txt" }
error: {"error": string}
Sends error information if the operation has failed. Example: { "error": "Error: ENOENT: no such file or directory, rename '/home/user1/dir1/foo.txt' -> '/home/user1/dir1/bar.txt'" }