Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Upload recent file from local server to the remote server

Jovy wrote:

I've tried the "-latest" command and it works fine although I need to upload files with a time duration (i.e. 24 hours). I've read that I could use "-filemask" but when I am executing .bat file, the script simply doesn't proceed. The cmd shows and closes immediately. Please help.

So do you run the script or the batch file?
Your batch file has quotes wrong.
See
https://winscp.net/eng/docs/commandline#syntax
https://winscp.net/eng/docs/faq_batch_file#quotes
Jovy

Upload recent file from local server to the remote server

Hi,

I've tried the "-latest" command and it works fine although I need to upload files with a time duration (i.e. 24 hours). I've read that I could use "-filemask" but when I am executing .bat file, the script simply doesn't proceed. The cmd shows and closes immediately. Please help.

Script:
open sftp://sftpJSamar:username@host_ip/ -hostkey=""
lcd C:\Users\Jovy.Samar\Desktop
cd /home/ftp-files/SAC/MASTERS
put -filemask="*>=1D" C:\Users\Jovy.Samar\Desktop\* /home/ftp-files/SAC/MASTERS
exit

Batch file:
@echo on

"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="C:\Users\Jovy.Samar\Desktop\log\WinSCP.log" /ini=nul ^
/command ^
"open sftp://sftpJSamar:username@host_ip/ -hostkey=""""" ^
"lcd C:\Users\Jovy.Samar\Desktop" ^
"cd /home/ftp-files/SAC/MASTERS" ^
"put -filemask="*>=1D" C:\Users\Jovy.Samar\Desktop\* /home/ftp-files/SAC/MASTERS" ^
"exit"

set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)

exit /b %WINSCP_RESULT%
martin

Re: automation downloading and uploading more recent file

Mahdi Bashiri wrote:

i would like to know is there ant script to do keep up to date remote or local directory like in gui option or no. and use this script to running all time and monitoring and changes and do downloading or uploading.

Please read documentation:
https://winscp.net/eng/docs/scriptcommand_keepuptodate
Mahdi Bashiri

automation downloading and uploading more recent file

Dear
i'm using winscp script to downloading more recent file from remote ftp server to localdirectory and uploading more recent file from localdirectory to remote ftp server and want to use these scripts to keep up to date by using :

synchronize local D:\IscFtp\Report Report for downloading
synchronize remote D:\IscFtp\In In for uploading

i would like to know is there ant script to do keep up to date remote or local directory like in gui option or no. and use this script to running all time and monitoring and changes and do downloading or uploading.

Regards,
Mahdi Bashiri