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?
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