Move Files using WildCard (*.sql) from one DIR to another via FTP

This topic contains 5 replies, has 2 voices, and was last updated by Profile photo of Wayne Simpson Wayne Simpson 3 months, 4 weeks ago.

  • Author
    Posts
  • #50112
    Profile photo of Wayne Simpson
    Wayne Simpson
    Participant

    I think the title says it in a nutshell.

    I need a script to run on a local machine, that will connect to an FTP Server, and move ALL *.SQL files from that DIR to another.

    Example: from ROOT to PROCESSING

    After research, I think I know what the process is – I just don't know how to implement it.

    So, the script would create a 'list' of all the *,SQL files – and then using that list it would either rename/copy them to the new DIR and then delete them from the ROOT?

    To give a bit more of an understanding of the problem, individual SQL files are uploaded to ROOT throughout the day – and could be added at any moment – so the script would be ran every 5-10 mins and "move" them to a DIR named PROCESSING.

  • #50118
    Profile photo of Daniel Krebs
    Daniel Krebs
    Participant

    You don't really need PowerShell for that. Just use the built-in Windows FTP client with an FTP script and trigger it via a scheduled task. FTP scripts support wildcards too.

    http://www.dostips.com/DtTipsFtpBatchScript.php

    • This reply was modified 3 months, 4 weeks ago by Profile photo of Daniel Krebs Daniel Krebs.
    • #50127
      Profile photo of Wayne Simpson
      Wayne Simpson
      Participant

      Thank you for your response. We have tried using .bat scripts and have some triggers using Windows Scheduler with success.

      It's just the moving from one dir to another using only the FTP server (not downloading to local machine) that there appears to be no simple command for.

      RNFR and RNTO give me an invalid command response from CMD when connected 🙁

  • #50129
    Profile photo of Daniel Krebs
    Daniel Krebs
    Participant

    Have you tried the FTP mput command?

    https://technet.microsoft.com/en-us/library/bb490668.aspx

    • #50133
      Profile photo of Wayne Simpson
      Wayne Simpson
      Participant

      I believe mput is for transfer between ftp and local machine so wouldn't solve the problem. It's crazy that such a seemingly simple thing to do isn't supported 🙁

      I've had success with Robo-FTP – so have a get out of jail free card – just there's a cost to it so it isn't free.

      I'll take a look at the powershell link you provided 🙂

      Edit – The powershell looks like FTP to Local (or vice versa)

      I need an FTP to FTP solution 🙂

      Thanks again

      • This reply was modified 3 months, 4 weeks ago by Profile photo of Wayne Simpson Wayne Simpson.
  • #50131
    Profile photo of Daniel Krebs
    Daniel Krebs
    Participant

    You can also see if you can get the PowerShell script on below site to work for you.

    https://gallery.technet.microsoft.com/scriptcenter/80647f66-139c-40a4-bb7a-04a2d73d423c

You must be logged in to reply to this topic.