Check file existence

Advertisement

thomasFrh
Joined:
Posts:
2

Check file existence

Hello all,

I try to find out how I can check whether a file exists. If the file not exists I want to send an email (-> backup script):

winscp.com /log=log.log /ini=nul /command ^ "option batch abort" ^ "open ftp://test:test@localhost/" ^ "option failonnomatch on" ^ "ls test.sql" ^ "exit"

if %ERRORLEVEL% neq 0 goto error

:error
echo No file found -> email
pause
exit 1

echo test

My question is how I have to change the script, because of course "ls" does not run... Unfortunately it is not possible to download the file, because the files are very big..

Maybe someone can help me!

Thanks,
Thomas

Reply with quote

Advertisement

thomasFrh
Joined:
Posts:
2

Re: Check file existence

Does anyone have an idea? I still tried a half day to find a way how to check whether the file exists... :(

Reply with quote

ansonee1
Guest

Check File Existence With Winscp.exe

I have found a ton of posts that instruct you how to check for the existence of a file, but every example I have found is for using WinSCP.com - I have yet to find an example that demonstrates how to use WinSCP.exe and how to check for a file with a mask.

Is there someplace I can find an example of this?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
29,501
Location:
Prague, Czechia

Re: Check File Existence With Winscp.exe

ansonee1 wrote:

I have found a ton of posts that instruct you how to check for the existence of a file, but every example I have found is for using WinSCP.com - I have yet to find an example that demonstrates how to use WinSCP.exe and how to check for a file with a mask.

Is there someplace I can find an example of this?
Your duplicate post:
https://winscp.net/forum/viewtopic.php?t=26959

Reply with quote

Advertisement

You can post new topics in this forum