• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
      • Overview
      • Execution Environments
      • Security and Formatting Options
      • Base Actions
      • Application Namespace
      • Clipboard Namespace
      • Data Namespace
      • Dictionary Namespace
      • File Namespace
      • Hash Namespace
      • Localhost Namespace
      • Logic Namespace
      • Message Namespace
      • Path Namespace
        • Path Action Invoker Namespace
        • Path.createDirectory Action
        • Path.getDirectoryListing Action
        • Path.getPathInfo Action
        • Path.getSpecialPaths Action
        • Path.selectFile Action
        • Path.showFileDialog Action
      • Settings Namespace
      • Sqlite Namespace
      • System Namespace
      • UI Namespace
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Path.createDirectory Action

Format
s = CS.Path.createDirectory(path := ...)
ArgumentDescriptionTypes / Required
pathThe path of the directory to create.string
required
Description
The Path.createDirectory action creates a directory if it does not already exist. If necessary, parent directories will be added to support the creation of the directory.
Directories can also be created using the dircreate function.
Return Value
The action returns a string containing the fully evaluated path of the directory.
Exceptions
The action throws an exception if any of its arguments are not specified in a valid form or if the directory cannot be created.
Example (JavaScript)
// get a listing of all images
const imageListing = CS.Path.getDirectoryListing({
    path: 
"Images",
    filter: 
"|FileType.Image"
});

// when there are images...
if( imageListing.paths.length > 0 ) {

   
// ...create the backup directory, suffixed with the UNIX time
    const backupDirectory = CS.Path.createDirectory({
        path: `Images-Backup-${Date.now()}`
    });

   
// ...and copy over all the images
    CS.File.copy({
        source: imageListing.paths,
        destination: backupDirectory
    });
}
See also: Path Action Invoker Namespace, DirCreate Function