movefile(fn,h;path,hs)

Read(360) Label: node, file, move, delete, rename,

Description:

Move a file from a node to another.

Syntax:

movefile(fn,h;path,hs)

Note:

The function moves file fn on node h, which is the local machine when omitted, to path path on node hs, which can be a node sequence. It renames fn when hs is absent, deletes fn when both path and hs are absent, removes files on hs when path and h are absent but hs is non-null.

Parameter:

fn

A file name

h

A node

path

A path (that contains file name) to which a file is moved, or a file name

hs

A node or a node sequence

Option:

@y

Force moving to overwrite a namesake file while default is failure, and deletion when path is null

@c

Copy the file, and the copy fails if there is already a namesake file

Return value:

Boolean

Example:

 

A

 

1

=movefile("D:/tmp.txt",["192.168.31.165:8281"];"D:/p1",["192.168.31.39:8281"])

Move tmp.txt on node "192.168.31.165:8281" to D:/p1 on node "192.168.31.39:8281".

2

=movefile("D:/t1.txt";"D:/p1",["192.168.31.39:8281","192.168.31.46:8281"])

Move t1.txt, which is a local file as parameter h is absent, to a sequence of nodes.

3

=movefile("D:/t2.txt",["192.168.31.165:8281"];"t2_new.txt")

Rename t2.txt on the specified node t2_new.txt since parameter hs is absent.

4

=movefile("D:/t2_new.txt",["192.168.31.165:8281"];)

Delete the specified file since both parameter path and parameter hs are absent.

5

=movefile("D:/p1/tmp.txt";,["192.168.31.39:8281"])

Delete D:/p1/tmp.txt on node "192.168.31.39:8281" since parameter h and parameter path are absent but parameter hs is non-null.

6

=movefile("emp.ctx",["192.168.31.165:8281"];"D:/p1",["192.168.31.39:8281"])

Move 2.emp.ctx in a homo-name files group on node "192.168.31.165:8281" to D:/p1 on node "192.168.31.39:8281".

7

=movefile@y("D:/tmp.txt";"D:/p1",["192.168.31.39:8281"])

@y option is used to force moving the file to overwrite the namesake file.

8

=movefile@y("D:/p1/tmp.txt";,["192.168.31.39:8281"])

@y option is used to force the deletion of the specified file when parameter path is absent.

9

=movefile@c("City.txt",["192.168.31.165:8281"];"D:/p1",["192.168.31.39:8281"])

Use @c option to copy the specified file.

10

=movefile@cy("City.txt";"D:/p1",["192.168.31.39:8281"])

Use @c@y options to force moving the specified file to overwrite the namesake file D:/p1/City.txt on node "192.168.31.39:8281".