Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
+1 vote
in CompleteFTP by (51.4k points)
edited by

A user needed CompleteFTP to automatically create any subdirectory of a Windows folder that the client tried to enter or upload a file to. For example, if a Windows folder at /Home/MyUser is mapped to the directory, C:\My\Directory, and a client tries to upload to the path, /Home/MyUser/A/B/C/D, then CompleteFTP should create C:\My\Directory\A\B\C\D if it doesn't already exist.

1 Answer

0 votes
by (51.4k points)
Best answer

We solved this problem using a JSS File-System Extension (available in the Enterprise MFT edition) with the following code:

// This extension will automatically create a subdirectory that a client
// tries to enter or upload a file to.

// Return the type of file-system adapter to inherit functionality from
function getBaseType() {
    return "windows";

// Indicate whether or not a directory exists
function directoryExists(path, session, node) {
    var path = node.configuration + "\\" + path.replace(/\//g, "\\");
    if (!System.IO.Directory.Exists(path))
    return true;

To use this extension:

  1. Make sure you're using the Enterprise MFT edition.
  2. Select the Extensions panel
  3. Click Add Extension -> Javascript (JSS) extension -> File system
  4. Enter 'Auto-directory' into the Name field
  5. Paste the above code into the code panel
  6. Click apply changes.
  7. Select the Folders panel
  8. Add a folder of type 'Auto-directory'
  9. Enter a Windows path into the dialog box that pops up and click OK
  10. Click Apply changes