Solved

PSFTP - How Do I Detect Successful Transfer from Output File?

Posted on 2010-08-18
6
1,763 Views
Last Modified: 2013-12-02
I have a Windows batch script (attached - UFASR03_Name_302_ftpput.bat) which PSFTP's a file to a host SFTP site.  In the batch script, I reference a batch file (attached - UFASR03_Name_302_ftpput.txt) of SFTP commands and I direct the output to a text file (attached - UFASR03_Name_302_ftpput_output.txt).  I need to report back the success or failure of the transmission to the scheduling system that initiated the batch job.  

What can I use in the output file to detect a successful transmission?  The string that I use to detect a successful transmission should only appear in the output file when the transmission is successful; never should it appear if the file was not transmitted properly.

With regular FTP, I can use the following:  findstr /c:"226 Transfer" %output%
But I can't use that "226 Transfer" string with SFTP.  It doesn't appear in the output.

As you can see from the attached output file (named UFASR03_Name_302_ftpput_output.txt), there is a string as follows:  

local:JohnDoe_201008.csv => remote:/incoming/JohnDoe_201008.csv

I believe this means the file was successfully transferred.  Can I use "=> remote" as a string to reliably indicate successful transmission 100% of the time?  Will this string ever appear if there's an error?  If not, what string should I use to detect successful transmission?
0
Comment
Question by:DoubleStroke
  • 3
  • 3
6 Comments
 

Author Comment

by:DoubleStroke
Comment Utility
Oops.  Here are the files.  Windows batch file is called UFASR03_Name_302_ftpput_batch.txt
UFASR03-Name-302-ftpput-batch.txt
0
 

Author Comment

by:DoubleStroke
Comment Utility
0
 
LVL 35

Expert Comment

by:torimar
Comment Utility
There seems to be no way for this in PSFTP, at least no documented one.

But PSCP will also try to use the SFTP protocol if possible, and you may even force it to do so by using the -sftp switch.
Unlike PSFTP, PSCP comes with a return value for successful transfers; please check "5.2.3 Return value" here:
http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter5.html#pscp
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 35

Expert Comment

by:torimar
Comment Utility
ps:

Also check "5.2.2.6 -sftp, -scp force use of particular protocol" right above the section quoted in my last comment.
0
 

Author Comment

by:DoubleStroke
Comment Utility
Torimar, I appreciate the advise but I need to use psftp.  Thank you.
0
 
LVL 35

Accepted Solution

by:
torimar earned 500 total points
Comment Utility
DoubleStroke,

in your closing request you state that "no other solutions were helpful".

Please bear in mind that if the set task is impossible, there can be no helpful solutions.
Should you have found a way to do this with PSFTP, please let me know, I'd be eager to learn.
If, however, as I would expect, you haven't found a way to do this with PSFTP, neither referenced here nor elsewhere, allow me to remind you of the written rule on Experts-Exchange that sometimes the correct answer to a question is: "You can't do that." (http://www.experts-exchange.com/help.jsp#hs=29&hi=405 )

In the latter case, my comment above (ID:33468060) gave the correct answer (that there is no way to do this in PSFTP) as well as a workaround.
0

Featured Post

Want to promote your upcoming event?

Is your company attending an event or exhibiting at a trade show soon? Are you speaking at a conference? Spread the word by using a promotional banner in your email signature. This will ensure your organization’s most important contacts are in the know.

Join & Write a Comment

Suggested Solutions

Samba is the de-facto standard program (or, more correctly: suite of programs) that UNIX and Linux systems use to share files with Microsoft Windows (and more recently, Mac OS-X) systems. Currently, there are 2 common versions of Samba available,…
Have you ever stumbled upon a software that is so great that you just love? It happened to me. Love at first sight. Filezilla Server.   Ok its not the most advanced ftp server I've came across. But its a fairly simple piece of software to get the …
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now