Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

JohanZA

SOLVED!

    "open sftp://root:<redacted>@<redacted>/ -hostkey=""ssh-<redacted> 255 <redacted>""" ^
    "cd /var/spool/asterisk/monitorDONE/Folder/" ^
    "lcd C:\Users\<redacted>\Music" ^
    "get "*<partial file name>*"" ^
    "exit"
JohanZA

Some progress

I have changed the script and now I'm getting new issues, which means progress:
    "open sftp://root:<redacted>@<redacted>/ -hostkey=""ssh-<redacted> <redacted>/<redacted>""" ^
    "cd /var/spool/asterisk/recording/" ^
    "get "*40058.mp" C:\Users\<redacted>\Music\ ^
    "exit"

Log file:
. 2024-10-11 11:23:47.707 Listing file "C:\Users\<redacted>\Music\".
> 2024-10-11 11:23:47.707 Type: SSH_FXP_LSTAT, Size: 60, Number: 1799
< 2024-10-11 11:23:47.798 Type: SSH_FXP_STATUS, Size: 24, Number: 1540
. 2024-10-11 11:23:47.798 Discarding reserved response
< 2024-10-11 11:23:47.798 Type: SSH_FXP_STATUS, Size: 29, Number: 1799
< 2024-10-11 11:23:47.798 Status code: 2, Message: 1799, Server: No such file, Language: 
< 2024-10-11 11:23:47.799 Script: Can't get attributes of file 'C:\Users\<redacted>\Music\'.
< 2024-10-11 11:23:47.799 No such file or directory.
< 2024-10-11 11:23:47.799 Error code: 2
< 2024-10-11 11:23:47.799 Error message from server: No such file
. 2024-10-11 11:23:47.800 Script: Failed
. 2024-10-11 11:23:47.800 Script: Exit code: 1
. 2024-10-11 11:23:47.800 Closing connection.
. 2024-10-11 11:23:47.800 Sending special code: 1
. 2024-10-11 11:23:47.807 Session sent command exit status 0
. 2024-10-11 11:23:47.807 Main session channel closed
. 2024-10-11 11:23:47.807 All channels closed
JohanZA

WinSCP Copy Script not Working

Hi All,

I really hope someone can help me.

I am trying to achieve the following:

  • Login
  • Navigate to directory
  • Copy all files containing a specific naming convention to a different directory
  • Move file from this directory to my local machine

    "open sftp://root:<redacted>@<redacted>/ -hostkey=""ssh-<redacted> <redacted>/<redacted>""" ^
    "cd /var/spool/asterisk/recording/" ^
    "cp *40058.mp /var/spool/asterisk/recordingdone ^
    "cd /var/spool/asterisk/recordingdone/" ^
    "mv 123456_2001_0824639433_20240724140058.mp C:\Users\<redacted>\Music
    "exit"

However I am receiving this issue:
< 2024-10-11 10:32:37.112 Script: /var/spool/asterisk/recording
> 2024-10-11 10:32:37.112 Script: cp *40058.mp /var/spool/asterisk/recordingdone ^
< 2024-10-11 10:32:37.112 Script: Operation not supported.
. 2024-10-11 10:32:37.113 Script: Failed
. 2024-10-11 10:32:37.113 Script: Exit code: 1
. 2024-10-11 10:32:37.113 Closing connection.

Please also note that this is my first attempt at scripting so any guidance would be helpful.