PUT latest file on sftp site

Advertisement

skumarlingam
Joined:
Posts:
5
Location:
NC

PUT latest file on sftp site

Hello experts,

Please let me know where went wrong in below code.

I am trying to upload only latest file out of all .bkp files. Each .bkp file generates every 15 minutes. I need to pickup latest .bkp file from list of files.

# Connect to SFTP server using a password
open sftp://wonder:Password;fingerprint=ssh-dss-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00@ftp.xyz.com/test/uploadfilehere/
# Upload file
lcd D:\Shares\takefilefromhere\
put *.bkp /test/uploadfilehere/ latest -nopreservetime
exit

Thank you in advance.

Reply with quote

Advertisement

skumarlingam
Joined:
Posts:
5
Location:
NC

sorry small change in my code

# Connect to SFTP server using a password 
open sftp://wonder:Password;fingerprint=ssh-dss-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00@ftp.xyz.com/test/uploadfilehere/ 
# Upload file 
lcd D:\Shares\takefilefromhere\ 
put *.bkp /test/uploadfilehere/ -latest -nopreservetime 
exit

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,567
Location:
Prague, Czechia

Re: PUT latest file on sftp site

The code looks good. If it does not do what you want, you have to tell us what it does and what you expected different. Also, attach a log file.

Reply with quote

cp713a
Joined:
Posts:
7
Location:
usa

Re: PUT latest file on sftp site

skumarlingam wrote:

It seems its working now. I don't know I didn't modify anything just another day.

Thank you.

I have exact problem, but i'm not able to use the 'lcd Z:\anotherfolder\upload\'. It says Error changing directory.
Any ideas?

Reply with quote

Advertisement

cp713a
Joined:
Posts:
7
Location:
usa

Re: PUT latest file on sftp site

cp713a wrote:

skumarlingam wrote:

It seems its working now. I don't know I didn't modify anything just another day.

Thank you.

I have exact problem, but i'm not able to use the 'lcd Z:\anotherfolder\upload\'. It says Error changing directory.
Any ideas?
Also, did you run this as /script or /command?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,567
Location:
Prague, Czechia

Re: PUT latest file on sftp site

cp713a wrote:

I have exact problem, but i'm not able to use the 'lcd Z:\anotherfolder\upload\'. It says Error changing directory.
Any ideas?
For sure there are more details in the error message (if you are using the latest version of WinSCP).

Reply with quote

Advertisement

You can post new topics in this forum