Moving Remote File To Another Remote Folder

Advertisement

the1nonlyku
Joined:
Posts:
2

Moving Remote File To Another Remote Folder

Hi all,

I've been trying to write a batch file that would move all .xlsx files to the archive folder, but it keeps failing. Could someone let me know what I'm doing wrong?

I've replaced my site info with test information since this has to do with my work. All of that information is correct since I got it from WinSCP.

I keep getting a error code 2. It says it cannot locate the file. I believe I am navigating to the file correctly. Any help would be appreciated.
@echo off
 
"C:\Users\kdixit\AppData\Local\Programs\WinSCP\WinSCP.com" ^
  /log="C:\writable\path\to\log\WinSCP.log" /ini=nul ^
  /command ^
    "open sftp://test:blahblahblah@ftp.test.csod.com/ -hostkey=""ssh key here"" -rawsettings ProxyPort=0" ^
    "cd /home/Reports/" ^
    "mv *.xlsx /home/Reports/Archive/" ^
    "exit"
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Attempt Failed!!!
)
 
exit /b %WINSCP_RESULT%

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,442
Location:
Prague, Czechia

Re: Moving Remote File To Another Remote Folder

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.

Also can you move the files in WinSCP GUI? If you can, post GUI log file too.

Reply with quote

the1nonlyku
Joined:
Posts:
2

When I attempt to log it gives me this error:
Error occurred during logging. It's been turned off.
Can't open log file 'C:\path\to\winscp.log'.
System Error. Code: 2.
The system cannot find the file specified

Reply with quote

Advertisement

You can post new topics in this forum