1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Acquire a Downloadable File in Batch

Discussion in 'Web & Email' started by Stanislovski, Aug 11, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. Stanislovski

    Stanislovski Guest Thread Starter

    Joined:
    Jun 26, 2008
    Messages:
    14
    Hi All

    I'm a programmer, but not in PC languages. There's an Excel file, available from a website, whose contents need to be downloaded and converted to another format. The actual conversion - i.e. the parts after downloading and saving as .csv - is done, but I'm wondering if the first part could be automated. The site does not provide FTP access - it's just a "right-click and download" situation.

    So, my question is:
    1. Can a simple batch file (or whatever) be created to download a specific named file from a specific site?
    2. Additionally, can the file be saved as .csv (from Excel) at the same time.

    At the moment I have to leave clunky instructions to the user to navigate to the site, right-click, etc., then call the conversion.

    Thanks in advance.
     
  2. -Fabez-

    -Fabez-

    Joined:
    Jul 28, 2008
    Messages:
    1,899
    Get the address of the file to be downloaded from the link, so the program knows where to download it from. Batch files are not high level so they will not be able to download from the internet, so it would be worth taking a look at a higher level language. If you want any help I will be happy to assist. :D
     
  3. Stanislovski

    Stanislovski Guest Thread Starter

    Joined:
    Jun 26, 2008
    Messages:
    14
    Thank you. That's very generous of you to offer.

    Is C++ like C? If so, we could maybe do this directly from the target machine and save a step. The target is an i5 (fomerly called iSeries and before that AS/400). It's connected to the internet (actually it's a web server), and it can run a C program.

    Here's a snippet of C - does it look familiar?

    #include <stdio.h>
    #include <time.h>
    int main(int argc, char *argv[])
    {
    time_t ltime;
    time(&ltime);
    sprintf(argv[1],"%s",ctime(&ltime)); return 0;
    }
    I don't program in C, but I can enter the source and compile it if need be.
     
  4. Techmonkeys

    Techmonkeys

    Joined:
    Feb 10, 2005
    Messages:
    625
  5. Stanislovski

    Stanislovski Guest Thread Starter

    Joined:
    Jun 26, 2008
    Messages:
    14
    Thanks Darren. Looks like Mr Fabez has moved on, so I guess I'll have a look at that batch file.
     
  6. -Fabez-

    -Fabez-

    Joined:
    Jul 28, 2008
    Messages:
    1,899
    Sorry I had some code to do for bigbobby07. Yes it does, it prints the first command line argument given to it along with a time of execution.
     
  7. Stanislovski

    Stanislovski Guest Thread Starter

    Joined:
    Jun 26, 2008
    Messages:
    14
    Okay, fair enough. I appreciate any time you can spare.

    The file is: http://www.nzba.org.nz/pdfs/Bank Branch Register July.xls

    The target directory is on an IBM i5 (formerly called iSeries, and before that AS/400) and it's identified as: /home/deskbank (no "drive" in this file system)

    Ideally, it would be nice to convert the file to .csv during the process if that's possible, but I can figure out how to do that separately if need be.

    Is this very complicated to do in C?
     
  8. Stanislovski

    Stanislovski Guest Thread Starter

    Joined:
    Jun 26, 2008
    Messages:
    14
    Mmmmm. Just realised that the month name is in the file name, dammit.

    Don't spend any time on it yet. I'll see if I can find out if the file is provided every month (in which case we can maybe substitute in the name of the current month) or whether it's only changed at irregular intervals (in which case we'd be stuffed for automation).
     
  9. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/739158

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice