Find the answer to your Linux question:
Results 1 to 3 of 3
Hello, Please forgive me lack of knowledge as a stumble through a very quick transition from Windows to Linux. I am trying to create a script to do the following.. ...
  1. #1
    Just Joined!
    Join Date
    Apr 2010
    Posts
    2

    Automated Ftp download of file with a name that changes

    Hello,

    Please forgive me lack of knowledge as a stumble through a very quick transition from Windows to Linux.

    I am trying to create a script to do the following..
    Login to a ftp and download a with the following naming convention xmtvMMDDYY.xml.gz
    on a daily basis followed by extracting that file. which I can do easy enough with a static filename. but the variable filename is throwing me off.

    I was planning on doing a mget with wildcard to just grab the entire directory but this found to not be as clean as I had hoped. Mainly due to the admins of the ftp keeping multiple days of the above mentioned file on the site.

    any advice or pointers on preforming these tasks would be greatly appreciated.
    basically the only command I am really stuck on would be the get function.
    Thanks

  2. #2
    Linux Newbie
    Join Date
    Mar 2010
    Posts
    121
    Quote Originally Posted by Crotinger View Post
    Login to a ftp and download a with the following naming convention xmtvMMDDYY.xml.gz
    You can use the date program with a format of "+%m%d%y" to make the dated part of the filename like so:

    Code:
    FILE="xmtv`date '+%m%d%y'`.xml.gz"

  3. #3
    Just Joined!
    Join Date
    Apr 2010
    Posts
    2
    Quote Originally Posted by JohnGraham View Post
    You can use the date program with a format of "+%m%d%y" to make the dated part of the filename like so:

    Code:
    FILE="xmtv`date '+%m%d%y'`.xml.gz"
    Works Perfectly Thanks a bunch for the quick reply.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...