Manipulating files

Use the sysFile command to perform common filesystem operations on files.

To... Use this command

Delete a file

sysFile -delete “filename”

Rename a file

sysFile -rename “filename” “newname”

Move a file

sysFile -move “filename” “newname”

(Identical to rename.)

Copy a file

sysFile -copy “filename” “newname”

For example:

// Move a scene to the new directory (we can rename it at the same time).
sysFile -rename "C:/temp/mayaStuff/myScene.mb.trash"
	"C:/maya/projects/default/scenes/myScene.mb"; // Windows
sysFile -rename "/tmp/mayaStuff/myScene.mb.trash"
	"/maya/projects/default/scenes/myScene.mb"; // Unix
// Rename the scene to "myScene.will.be.deleted"
sysFile -rename "C:/temp/mayaStuff/myScene.will.be.deleted"
	"C:/temp/mayaStuff/myScene.mb.trash"; // Windows
sysFile -rename "/tmp/mayaStuff/myScene.will.be.deleted"
	"/tmp/mayaStuff/myScene.mb.trash"; // Unix
// Copy a scene to the new directory
string $destWindows = "C:/temp/mayaStuff/myScene.mb.trash";
string $srcWindows = "C:/maya/projects/default/scenes/myScene.mb";
sysFile -copy $destWindows $srcWindows; // Windows
string $destUnix = "/tmp/mayaStuff/myScene.mb.trash";
string $srcUnix = "maya/projects/default/scenes/myScene.mb";
sysFile -copy $destUnix $srcUnix; // Unix
// Delete the scene
sysFile -delete "C:/temp/mayaStuff/myScene.will.be.deleted"; // Windows
sysFile -delete "/tmp/mayaStuff/myScene.will.be.deleted"; // Unix

Manipulating the open scene file

The file command lets you perform various functions from the File menu, functions for manipulating files and references and their contents, and functions for testing files.