Go to: Synopsis. Return value. Related. Flags. Python examples.

Synopsis

sysFile( string , [copy=string], [delete=boolean], [makeDir=boolean], [move=string], [removeEmptyDir=boolean], [rename=string])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

sysFile is undoable, NOT queryable, and NOT editable.

This command provides a system independent way to create a directory or to rename or delete a file.

Return value

boolean True if successful, false otherwise.

Related

getFileList

Flags

copy, delete, makeDir, move, removeEmptyDir, rename
Long name (short name) Argument types Properties
delete(delete) boolean create
Deletes the file.
rename(ren) string create
Rename the file to the name given by the newFileName parameter.
move(mov) string create
Behaves identically to the -rename flag and remains for compatibility with old scripts
copy(cp) string create
Copy the file to the name given by the newFileName paramter.
makeDir(md) boolean create
Create the directory path given in the parameter. This will create the entire path if more than one directory needs to be created.
removeEmptyDir(red) boolean create
Delete the directory path given in the parameter if the directory is empty. The command will not delete a directory which is not empty.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

# Create a new directory path
cmds.sysFile( 'C:/temp/mayaStuff', makeDir=True )# Windows
cmds.sysFile( '/tmp/mayaStuff', makeDir=True )# Unix
# Move a scene to the new directory (we can rename it at the same time).
cmds.sysFile( 'C:/maya/projects/default/scenes/myScene.mb', rename='C:/temp/mayaStuff/myScene.mb.trash' )# Windows
cmds.sysFile( '/maya/projects/default/scenes/myScene.mb', rename='/tmp/mayaStuff/myScene.mb.trash' )# Unix
# Rename the scene to "myScene.will.be.deleted"
cmds.sysFile( 'C:/temp/mayaStuff/myScene.mb.trash', rename='C:/temp/mayaStuff/myScene.will.be.deleted' )# Windows
cmds.sysFile( '/tmp/mayaStuff/myScene.mb.trash', rename='/tmp/mayaStuff/myScene.will.be.deleted' )# Unix
# Copy a scene to the new directory
destWindows = "C:/temp/mayaStuff/myScene.mb.trash"
srcWindows = "C:/maya/projects/default/scenes/myScene.mb"
cmds.sysFile( srcWindows, copy=destWindows )# Windows
destUnix = "/tmp/mayaStuff/myScene.mb.trash"
srcUnix = "maya/projects/default/scenes/myScene.mb"
cmds.sysFile( srcUnix, copy=destUnix )# Unix
# Delete the scene
cmds.sysFile( 'C:/temp/mayaStuff/myScene.will.be.deleted', delete=True )# Windows
cmds.sysFile( '/tmp/mayaStuff/myScene.will.be.deleted', delete=True )# Unix