FileUtil.MoveFileOrDirectory 移动文件或文件夹

static function MoveFileOrDirectory (from : string, to : string) : void

Description描述

Moves a file or a directory from a given path to another path.

从给定的路径中移动文件或目录到另一个路径。

This function's path is relative to the project root folder but it can also accept absolute paths.

这个方法可以使用相对路径也可以使用那个绝对路径

All file separators should be forward ones "/".

所有的文件目录分隔符必须使用“/”格式。

Make sure to include the name of the files or directories at the end of the "to" argument

一定要在函数的最后一个参数上添加要把文件移动到的目录。

// creates a menu entry to move a file or a directory.
//创建一个菜单项,来移动一个文件或文件夹
@MenuItem ("Example/Move Something")
static function MoveAFile () {
	// moves the file "YourFileOrFolder" from "path/" to "move/path/"
	//从"path/"移动文件YourFileOrFolder到"move/path/"
	FileUtil.CopyFileOrDirectory("path/YourFileOrFolder", "move/path/YourFileOrFolder");
}
Page last updated: 2011-5-7