Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Command-line FTP client + batch scripts

Options
  • 14-11-2012 1:05pm
    #1
    Moderators, Arts Moderators, Regional Abroad Moderators Posts: 11,019 Mod ✭✭✭✭


    As an exercise, recently I've been working on a batch file that can update the most common web-facing applications installed on a Windows system. (Why a batch file? Because if I do it right I get something that can be used in XP, Vista or 7 with equal facility. I'm not worried about 8 yet because it won't hit any kind of deployment-critical-mass for at least 6 months).

    One of the interesting things I've discovered is the basic-but-functional command-line ftp client that's present in all the aforementioned versions of Windows.

    This potentially lets me automate the retrieval of update files, so long as I craft a suitable script for the ftp client to use. Unfortunately Adobe have decided that the way they'll do things is not to have a dedicated directory for the latest releases but instead to gather each application family in a subdirectory based on major release number.

    I'm now trying to work out whether there's a clever way of finding out the most recently created subdirectory in a given directory and then copying the contents of that directory, or whether I should look elsewhere for this.

    I realise this is a total throwback-to-1998 type question, but I also figure that there's quite a lot you can do on the command line that spans multiple Windows releases and it would be good to have somewhere for people to share this stuff.

    (And no, before anyone thinks of saying so, I don't want to use PowerShell for this if I can help it. Not because I object to PowerShell - I think it's great and love using it for AD-related stuff. However, the differences in certain syntaxes between PS1 and PS2 and presumably PS3 mean you need to have version-tracking in place, not to mention that to run a PS script on XP you'd need to wrap it in a complicated batch file that checks if PS is installed, installs it if not, then invokes the script...)


Comments

  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 90,855 Mod ✭✭✭✭Capt'n Midnight


    check out if wget can do it - one low tech way is to pull down all new files

    wget -rH -l 1 -A %1*.bin --tries=3 --no-directories --html-extension --span-hosts --dot-style=mega http://free.avg.com/us-en/download-update



    -nc, --no-clobber skip downloads that would download to
    existing files (overwriting them).
    -c, --continue resume getting a partially-downloaded file.
    --progress=TYPE select progress gauge type.
    -N, --timestamping don't re-retrieve files unless newer than
    local.


    --spider don't download anything.


  • Moderators, Arts Moderators, Regional Abroad Moderators Posts: 11,019 Mod ✭✭✭✭Fysh


    Yeah, I was trying to work out if I could use wget but decided against it for the time being because the version I was looking at required the software to be installed. If there's a portable version of wget, though, it might be the best option.

    Still, it's handy to know that there's a commandline native ftp client in windows as well as the optional sftp client. If only they had a native commandline ssh client as well...


Advertisement