To move a file to another folder on the SFTP server, you can use the SFTP library’s move method.
The source and destination path is constructed by combining the source directory with the file name.
// Define the destination folder on the SFTP server
let destinationFolder = '/Processed Purchase Orders';
let sourcePath = '/Purchase order Details from footprint/' + fileName;
let newFilePath = destinationFolder + '/' + fileName;
// Use the move method to move the file to the new location on the SFTP server
connection.move({
from: sourcePath,
to: newFilePath
});