Answer» 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! pauseWhile 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? 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.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.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.
Thanks so much!!
If this works, im gonna find and seduce you!!
But seriously thanks. I will test this as soon as possible and let you know.Quote from: PPowerHouseK on March 02, 2010, 10:19:09 AM Thanks so much!!
If this works, im gonna find and seduce you!!
But seriously thanks. I will test this as soon as possible and let you know.
Umm...a little bit over-the-top and AWKWARD...Quote from: Helpmeh on March 02, 2010, 05:28:53 PMUmm...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. Sorry...I don't do long-distance relationships.
|