movefile(fn:z,path)

阅读(1153) 标签: 文件, 移动, 删除, 重命名,

描述:

移动、删除或对文件重命名。

语法:

movefile(fn:z,path)

备注:

将文件fn移动到指定路径文件path中,path省略代表将文件删除,path只有文件名时表示对文件重命名。

参数:

fn

文件名称。

z

整数,当fn是文件组时,z为分表号,否则z省略。

path

文件移动路径(包含文件名)或文件名。

选项:

@y

目标文件已存在时强行操作,缺省将失败,path为空时强行删除。

@c

复制文件,目标文件重名时复制失败。

@p

path是相对路径时是相对于主目录的,缺省是相对fn的父目录。

返回值:

Boolean

示例:

 

A

 

1

=movefile("E://test.property","D://testfile.property")

将文件移动到D盘根目录testfile.property文件中。

2

=movefile("D://testfile.property","file.property")

D://testfile.property文件重命名为file.property

3

=movefile("D://file.property")

删除file.property文件。

4

=movefile@y("E://test1.property","D://testfile1.property")

文件testfile1.property已经存在,强制移动覆盖原来的文件

5

=movefile@c("D://testfile1.property","file.property")

复制文件,并不是文件重命名

6

=movefile@cy("E://test2.property","D:// file.property")

文件file.property已经存在,强制复制覆盖原来的文件

7

=movefile@y("D://testfile1.property")

删除testfile1.property文件

8

=movefile@cp("D://testfile1.property","file.property")

复制文件到主目录下,并命名为file.property

相关概念:

f. exists()

f. date()

f. size()