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

Author Topic: Composing a batch to work w/ Windows FTP  (Read 11893 times)

0 Members and 1 Guest are viewing this topic.

PPowerHouseK

  • Guest
Composing a batch to work w/ Windows FTP
« on: February 16, 2010, 10:16:48 AM »
Hello all,

I am writing a batch to upload files from my hard drive to the server via windows ftp and batch. I have most of the process worked out, the batch part simply runs:
Code: [Select]
@ECho off
REM Use FTP to transfer cache to host computer
ftp -s:ftp.txt
ECHO Process Complete!
pause
While the ftp.txt contains this:
Code: [Select]
hash
open
(host)
(username)
(password)
bin
prom
mput C:\xampp\htdocs2\Filehost\public_html4\garrysmod\*.*
fastdl\FileHost4\garrysmod\
bye

This is what I have and the result is usually:
Code: [Select]
ftp> mput C:\xampp\htdocs2\Filehost\public_html4\garrysmod\*.*
Error opening local file ?????????????????????????.
Error opening local file ?????????????????????????..
200 PORT command successful.
125 Data connection already open; Transfer starting.

226 Transfer complete.
ftp: 995 bytes sent in 0.00Seconds 995.00Kbytes/sec.
Error opening local file ???????????????????????????.
Error opening local file ??????????????????????????s.
Error opening local file ?????????????????????????????.
Error opening local file ???????????????????????????s.
Error opening local file ????????????????????????????.
Error opening local file ????????????????????????????s.
Error opening local file ???????????????????????????.
ftp> fastdl\FileHost4\garrysmod\
Invalid command.
ftp> bye
221 Goodbye.

As you can see my method of transferring an entire folder, is not working. I have searched for days on google, about how to do this, to no avail.
Any helpful advise is much appreciated. IE, don't just post saying what I did was wrong. I know that much otherwise I wouldn't have posted, now would I? ;)

Helpmeh



    Guru

  • Roar.
  • Thanked: 123
    • Yes
    • Yes
  • Computer: Specs
  • Experience: Familiar
  • OS: Windows 8
Re: Composing a batch to work w/ Windows FTP
« Reply #1 on: February 17, 2010, 06:53:44 AM »
The problem is, mput's syntax is:
mput local-files [ ...]

So, an example of the command is:

mput file1.txt file3.txt file4.txt

What you can do is this though:
@echo off
echo USERNAME >> ftp
echo PASSWORD >> ftp
echo OTHER COMMANDS >> ftp
for /f "delims=" %%a in ('dir /b /s C:\xampp\htdocs2\Filehost\public_html4\garrysmod\*.*') do echo PUT %%a >> ftp
echo bye >> ftp
ftp -s:ftp HOST

Not quite sure if this will work though, but it is worth a shot.
Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.

PPowerHouseK

  • Guest
Re: Composing a batch to work w/ Windows FTP
« Reply #2 on: February 20, 2010, 06:15:52 PM »
That works great, except that it puts all the files in the same directory. I need to maintain the sub directories.  Thanks for your help.

JenniC



    Rookie

    Re: Mirroring local directory structure to FTP server via biterscripting
    « Reply #3 on: March 02, 2010, 09:19:02 AM »
    PPowerHouseK:

    Quote
    I need to maintain the sub directories.



    Use this script. I have been using it. Works like a charm.

    http://www.biterscripting.com/helppages/SS_FTPUpload.html



    You don't have to look at the code. They have already written for us. We just use their pre-written script. This script is automatically installed with biterscripting.


    It uploads all files under a top directory. It will maintain the directory structure. And, it will create subdirectories as necessary. In short, it will mirror the entire directory structure from your computer to the FTP server. And, it will upload files in appropriate mode, text for .html, binary for .gif, etc.

    It's pretty simple to use. All you have to do is to start biterscripting, and enter command.

    Code: [Select]
    script "SS_FTPUpload.txt" ftpserver("ftp.mycompany.com") ftplogin("me") ftppassword("my password") localpath("/mywebsite") remotepath("/pages")

    Enter the whole above command on one line. Use correct values in place of "ftp.mycompany.com", "me", "my password", etc. Then, sit back and watch it do its work - directory by directory, file by file.




    PPowerHouseK

    • Guest
    Re: Composing a batch to work w/ Windows FTP
    « Reply #4 on: March 02, 2010, 10:19:09 AM »
     :o Thanks so much!!

    If this works, im gonna find and seduce you!! :-X

    But seriously thanks. I will test this as soon as possible and let you know.

    Helpmeh



      Guru

    • Roar.
    • Thanked: 123
      • Yes
      • Yes
    • Computer: Specs
    • Experience: Familiar
    • OS: Windows 8
    Re: Composing a batch to work w/ Windows FTP
    « Reply #5 on: March 02, 2010, 05:28:53 PM »
    :o Thanks so much!!

    If this works, im gonna find and seduce you!! :-X

    But seriously thanks. I will test this as soon as possible and let you know.
    Umm...a little bit over-the-top and awkward...
    Where's MagicSpeed?
    Quote from: 'matt'
    He's playing a game called IRL. Great graphics, *censored* gameplay.

    PPowerHouseK

    • Guest
    Re: Composing a batch to work w/ Windows FTP
    « Reply #6 on: March 03, 2010, 09:19:23 AM »
    Umm...a little bit over-the-top and awkward...

    Precisely what I was going for, it meant that much to me. But don't worry, you're still my favorite.  :-*

    Helpmeh



      Guru

    • Roar.
    • Thanked: 123
      • Yes
      • Yes
    • Computer: Specs
    • Experience: Familiar
    • OS: Windows 8
    Re: Composing a batch to work w/ Windows FTP
    « Reply #7 on: March 03, 2010, 04:10:01 PM »
    Sorry...I don't do long-distance relationships.
    Where's MagicSpeed?
    Quote from: 'matt'
    He's playing a game called IRL. Great graphics, *censored* gameplay.