1

Need to delete the files from a sftp remote server based on last modified time .Files which are older then 30 days no need to keep in server .I have tried ls -lt ,but how to copy it to local machine and get modified date from there? .Then again need to use rm command to remove files based on the date I got from listing . We don't have ssh access over the sftp server .So can't use mtime to get modified time details directly .Also most of the commands won't support over sftp.Please share you suggestions . The script and commands need to call as part of a etl job .

  • 1
    You might be able to do something with Perl or Python, which have built-in libraries to communicate with an SFTP server. – roaima Jun 10 at 14:26
0

Consider using sshfs to mount the sftp server, which will allow to treat the files as local files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.