Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: FTP'ing  (Read 3207 times)

0 Members and 1 Guest are viewing this topic.

abcdefg

  • Guest
FTP'ing
« on: July 11, 2006, 10:47:11 AM »
Hello all,

Am trying to work out how to save file(s) to a certain folder on my PC when obtaining them via FTP.

At the same time I'd like to rename them based on the date.

I need to make the process automatic, so the commands will be run from a text file.

Any help much appreciated!

gpl



    Apprentice
  • Thanked: 27
    Re: FTP'ing
    « Reply #1 on: July 11, 2006, 07:30:46 PM »
    To change the directory on your pc, use LCD (Local Change Directory)
    To rename a file, do
    get <remaote name> <local name>
    so if you want to use todays date, you will have to create your script on the fly, then call it

    Graham

    DosItHelp



      Intermediate
      Re: FTP'ing
      « Reply #2 on: July 11, 2006, 10:30:11 PM »
      Or download the file always into the temp directory as gpl describes and then move afterwards.
      I.e. lets say you down loaded file is named "server.log" that was downloaded to "C:\temp" and your final archive folder is "c:\archive" then the following should work


      Code: [Select]
      ftp -i -s:"FtpScriptName.txt"

      set UNIQUE=%date:~10%%date:~4,2%%date:~7,2%
      move /y "C:\temp\server.log" "C:\temp\server_%UNIQUE%.log"

      Tips to embed a FTP script into a cmd batch file here:
      http://dostips.cmdtips.com/DtCodeBatchFiles.php

      Hope this helps  ;)

      abcdefg

      • Guest
      Re: FTP'ing
      « Reply #3 on: July 13, 2006, 05:12:05 AM »
      That's really helpful, thanks!!  ;D