FTP batch processing and return code

Posted on 2006-05-03
Last Modified: 2008-03-04
My application needs to upload files on a remote server. I think FTP is the best way to do that and I'm writing the FTP batch (running on Windows 2000).

The basic scripting is ok (connexion and put command) but I cannot figure out how to know whether the command has been completed or not.

In fact my application need to upload a specific file to the remote host and DELETE it locally if the FTP was done correctly. If FTP failed, the local file should NOT be deleted and it will be uploaded in a fruther attempt.

What could I use in order to get the result (return code) of my FTP command (I'm using FTP -s:script.ftp)?
Thank you in advance for your help.
J. Zimmerli
Question by:joel011197
    LVL 11

    Accepted Solution

    I think you can redirect the output from the console to a file and after that check if in the content of the file a certain string presents.
    LVL 3

    Assisted Solution

    Try adding this to the end of the command..

    >>c:\test.txt (this would place a log file in c: named test.txt)  It would look like this...

    FTP -s:script.ftp >> c:\test.txt

    Author Comment

    Both suggestions were ok but a little bit to complicated to implement. Furthermore, I need to get different error level if 1) login failed or 2) file upload failed.
    So I installed easyphp on my box and the different ftp functions are exactely doing what I need.
    Thank you for your help.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…

    733 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

    22 Experts available now in Live!

    Get 1:1 Help Now