sftp make directory
# ask-stanley-ai
v
sftp make directory
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems that you are trying to create a directory using SFTP in NetSuite. However, there are some issues that you are facing. Here are some suggestions that might help: 1. Make sure that the directory you are trying to create does not already exist. The error
FTP_NO_SUCH_FILE_OR_DIRECTORY
suggests that the directory you are trying to create might already exist. 2. Ensure that you are passing the correct parameters to the
createConnection
function. The
directory
parameter should be the path of the directory you want to create. 3. Check your permissions. Make sure that the user has the necessary permissions to create a directory. 4. The error might be due to improper usage of the SFTP module. The SFTP module in NetSuite is quite unforgiving with improper usage. Any small mistake can lead to an unexpected error. Here is a sample code snippet for creating a connection:
Copy code
javascript
const _connectionSFTP = (record) => {
    let isSftp = record.getValue('custrecord_mvc_is_sftp');
    let keyId = record.getValue('custrecord_mvc_sftp_key');
    let url = record.getValue('custrecord_mvc_ftp_address');
    let port = record.getValue('custrecord_mvc_ftp_port');
    let username = record.getValue('custrecord_mvc_integration_user');
    let hostKey = record.getValue('custrecord_mvc_sftp_host_key');
    let directory = record.getValue('custrecord_mvc_ftp_folder');
    log.debug('Establishing SFTP connection...');
    try {
      const connection = sftp.createConnection({
        url: url,
        keyId: keyId,
        hostKey: hostKey,
        username: username,
        port: eval(port),
        hostKeyType: 'rsa',
        directory: directory,
      });

      log.debug('Connected successfully');

      return connection;
    } catch(error) {
      _sendErrorEmail('Falha ao conectar com o servidor de SFTP');
      log.debug('error', error)
      throw new Error(Falha ao conectar com o servidor de SFTP);
    }
  };
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.799273849
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.798369944
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.796725
Please provide your feedback on this answer.