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

dipesht@...

Batch file error

"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\WinSCP\WinSCP.log" /rawconfig Logging\LogFileAppend=0 /ini=nul /command ^
    "open ftp://username:password@ip address:port/ -passive=off" ^
    "cd /remote directory" ^
    "lcd ""local directory""" ^
    "put -filemask=*>=today ""Local directory\*"" -delete" ^
    "exit"
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
 
exit /b %WINSCP_RESULT%
natchiram

Sorry for the delay. After adding the switch -passive=off, the script worked fine.
Thank you very much for your help.

The modified script is as below:
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\WinSCP\WinSCP.log" /rawconfig Logging\LogFileAppend=0 /ini=nul /command ^
    "open ftp://username:password@ip address:port/ -passive=off" ^
    "cd /remote directory" ^
    "lcd ""local directory""" ^
    "put -filemask=*>=today ""Local directory\*"" -delete" ^
    "exit"
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
 
exit /b %WINSCP_RESULT%
natchiram

I am not able to see the folders from any of the FTP clients but can navigate to that folder using the credentials in the Windows Explorer. Also, I can transfer the file manually using a simple cmd line script as below, but there are some conditions that I need to add, such as file size, date of creation, which is why I am using WinSCP.
Drive:

cd\path
ftp
OPEN host port
username
password
cd remote location
PUT filename
CLOSE
QUIT
martin

I seems that you do not have a full FTP network connectivity to your server.
See https://winscp.net/eng/docs/ftp_modes
Or can you connect anyhow from your machine? In WinSCP GUI? In any other FTP client?
natchiram

Hi, Thanks for your response. The full log file that got generated was attached to the original post.
martin

Re: Batch file to upload files created today

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, use /log=C:\path\to\winscp.log command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
natchiram

Batch file to upload files created today

Hi, I am trying to put a file into a remote location and delete it after the upload process completes. It is failing with this error
(ExtException) **Copying files to remote side failed.**

I have attached the log file.

The script that I am using is as below:
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\WinSCP\WinSCP.log" /rawconfig Logging\LogFileAppend=0 /ini=nul /command ^
    "open ftp://username:password@ip address:port/" ^
    "cd /remote directory" ^
    "lcd ""local directory""" ^
    "put -filemask=*>=today ""Local directory\*"" -delete" ^
    "exit"
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
 
exit /b %WINSCP_RESULT%

Regards,
Ram