movefile(fn,path)

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

描述:

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

语法:

movefile(fn,path)

备注:

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

参数:

fn

文件

path

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

选项:

@y

目标文件已存在时强行操作,缺省将失败。

@c

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

返回值:

布尔值

示例:

 

A

 

1

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

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

2

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

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

3

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

删除file.property文件

4

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

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

5

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

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

6

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

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

相关概念:

f. exists()

f. date()

f. size()