Solved

Checking if file exists using WinSCP

Posted on 2015-01-29
7
855 Views
Last Modified: 2015-02-18
I need to check if the EXTRmmDD.ZIP exists on the SFTP.

If it does, than put it in the C:\ziptest folder.

If it does not exist exit successfully.

I have attached my script that currently pulls the file down successfully if it already exists on the SFTP.
CheckIfFileExistsWINSCP.txt
0
Comment
Question by:flagshipcredit
  • 2
  • 2
  • 2
7 Comments
 
LVL 43

Expert Comment

by:Steve Knight
ID: 40577893
on phone so will look back later... you may want to simplify your yesterday getting routine to two lines.  See some examples in my article here:

Will look back from pc later if I can.
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_1153-Using-dates-in-batch-files-scripts.html Steve
0
 

Author Comment

by:flagshipcredit
ID: 40586188
Do you know how I can check if the file exists?
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 40586806
Off hand I don't sorry.  The easiest way IMO would be to make it download into a known empty directory, then if a file exists in there it is the one you want.  If no file exists then it didn't need to run?  Is that a suitable option?
0
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 
LVL 53

Expert Comment

by:Bill Prew
ID: 40615766
Slightly confused.  AS it stands, wouldn't you get the results you want.  WINSCP will try and transfer the file you are specifying, and if it exists will xfer it.  If it doesn't exist I expect WINSCP will error, but will not transfer any file.  Isn't that the result you wanted?

~bp
0
 

Author Comment

by:flagshipcredit
ID: 40616567
I need the file to check every 5 minutes. I do not want to get an email every 5 minutes saying the job failed.
0
 
LVL 53

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 40616590
Okay, in that case I think it will be a two step process.  First, use WINSCP to do a listing of the files available in the FTP server location, and save that list to your local PC.  Then process the list file and see if the file you want is in there.  If it is do a second step to actually download it.

If you need help with those WINSCP commands and the support BAT script let me know I can try to put something together.

~bp
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If your business is like most, chances are you still need to maintain a fax infrastructure for your staff. It’s hard to believe that a communication technology that was thriving in the mid-80s could still be an essential part of your team’s modern I…
I had an issue with InstallShield not being able to use Computer Browser service on Windows Server 2012. Here is the solution I found.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question