SFTP – Error during Move function of some files.

I recently wrote a script that I am using the SFTP module to connect to a SFTP server and find files with a specific folder on the server that match specific naming convention.  I then read the file contents and then I move the file from the current folder to an archive folder. Most of the time the script works just as it should, but I am running into some weird issues with the move function is performed sometimes.  I am getting an unusual amount of errors like the following.

Source ‘/NetSuite/WMS_OUT/SHIP_BULK_S9057776_20569.xml/’ must be readable and destination ‘/NetSuite/WMS_ARCHIVE/SHIP_BULK_S9057776_20569.xml/’ must be writable.

The weird part is even though the script is getting this error, the file is being moved on the server. Has anyone else come across this before?

Rookie Asked on April 28, 2021 in SuiteScript.

maybe each time you are using with a different user,  and that user needs write permission/read permission for that directory.

on April 29, 2021.
Add Comment
1 Answer(s)

This could happens for two reasons

1-  u need to check the pending (source) & archived (destination) file and folder permissions. ls -l  linux command will list the file permission ex. rwxrwxrwx  (r=read & w= write & x =execute & -= not authorized action)

2- you should not use the full path from and to params if you already connected to a parent folder

            this.moveFiles = function (connection, file) {
                connection.move({
                    from:’/’ + file,
                    to: ‘/Archived/’+file
                })
            }

 

Rookie Answered on November 29, 2021.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor   Become a Sponsor