Working with directories

 
 
 
To... Use this command

Change the current working directory.

chdir “path”

Return an array of filenames in a directory.

getFileList

Make a new directory.

sysFile -makeDir “dirname”

For example:

// List the contents of the user's projects directory
getFileList -folder `internalVar -userWorkspaceDir`;
// Store all MEL files in the user's script directory
// in an array variable
string $scriptDir = `internalVar -userScriptDir`;
string $scripts[] = `getFileList -folder $scriptDir -filespec "*.mel"`;
// Create a new directory path
sysFile -makeDir "C:/temp/mayaStuff"; // Windows
sysFile -makeDir "/tmp/mayaStuff"; // Unix

Creative Commons License Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License