This command provides a system independent way to create a directory or to rename or delete a file.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
copy (cp) | unicode | ||
|
|||
delete (delete) | bool | ||
|
|||
makeDir (md) | bool | ||
|
|||
move (mov) | unicode | ||
|
|||
removeEmptyDir (red) | bool | ||
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 commandFlag can have multiple arguments, passed either as a tuple or a list. |
|||
rename (ren) | unicode | ||
|
Derived from mel command maya.cmds.sysFile
Example:
import pymel.core as pm
# Create a new directory path
pm.sysFile( 'C:/temp/mayaStuff', makeDir=True )# Windows
# Result: False #
pm.sysFile( '/tmp/mayaStuff', makeDir=True )# Unix
# Result: True #
# Move a scene to the new directory (we can rename it at the same time).
pm.sysFile( 'C:/maya/projects/default/scenes/myScene.mb', rename='C:/temp/mayaStuff/myScene.mb.trash' )# Windows
# Result: False #
pm.sysFile( '/maya/projects/default/scenes/myScene.mb', rename='/tmp/mayaStuff/myScene.mb.trash' )# Unix
# Result: False #
# Rename the scene to "myScene.will.be.deleted"
pm.sysFile( 'C:/temp/mayaStuff/myScene.mb.trash', rename='C:/temp/mayaStuff/myScene.will.be.deleted' )# Windows
# Result: False #
pm.sysFile( '/tmp/mayaStuff/myScene.mb.trash', rename='/tmp/mayaStuff/myScene.will.be.deleted' )# Unix
# Result: False #
# Copy a scene to the new directory
destWindows = "C:/temp/mayaStuff/myScene.mb.trash"
srcWindows = "C:/maya/projects/default/scenes/myScene.mb"
pm.sysFile( srcWindows, copy=destWindows )# Windows
# Result: False #
destUnix = "/tmp/mayaStuff/myScene.mb.trash"
srcUnix = "maya/projects/default/scenes/myScene.mb"
pm.sysFile( srcUnix, copy=destUnix )# Unix
# Result: False #
# Delete the scene
pm.sysFile( 'C:/temp/mayaStuff/myScene.will.be.deleted', delete=True )# Windows
# Result: False #
pm.sysFile( '/tmp/mayaStuff/myScene.will.be.deleted', delete=True )# Unix
# Result: False #