[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Checking if file exists using WinSCP

Posted on 2015-01-29
7
Medium Priority
?
1,252 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

 
LVL 57

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 57

Accepted Solution

by:
Bill Prew earned 1500 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

WARNING:   If you follow the instructions here, you will wipe out your VTP and VLAN configurations.  Make sure you have backed up your switch!!! I recently had some issues with a few low-end Cisco routers (RV325) and I opened a case with Cisco TA…
Make the most of your online learning experience.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

649 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