Results 1 to 3 of 3
  1. #1
    Experienced User
    Overall activity: 0%

    Join Date
    Feb 2008
    Location
    Socket LGA 771
    Posts
    1,785
    Liked
    3 times
    Points
    14,465

    Post Automate FTP Uploads Using Commandline

    Here's an an example. Consider that you need to automate uploading any file(s) to your site, say raymond.cc
    You'll require this if you need to update the same file(s) very frequently.

    1.
    Open notepad and type the following and save it as "upload.ftp". You can save it with any name and any extension.
    Don't save it as txt file. It works perfectly but others can open and see the ftp username and password easily.
    Code:
    open raymond.cc
    username
    password
    cd public_html/downloads
    put C:\MySite\go.exe
    bye
    * First line will make connection to ftp server at raymond.cc.
    * Dont't forget to replace raymond.cc with your site or IP.
    * Enter you ftp username and password in second and third line respectively.
    * Next is you've got type the path on your server where you need to upload the files. When you login to ftp, usually you are in the root direcrory or "\". In case of linux(like cPanel) the path would be public_html and in case of windows(like Plesk), path will be httpdocs.
    * The put command uploads the file. You need to give the full path of the file to upload.
    * In the last line, bye command terminates the ftp session.

    2.
    Next you need to create a batch file in the same directory where you've created "upload.ftp". Open notepad and type the following code. Save it with any name with .bat extension like "Auto_FTP.bat"
    Code:
    @echo off
    ftp -s:"upload.ftp" >> ftplog.log
    The above batch script will tell ftp utility to load the commands from the file "upload.ftp". To check the file transaction, a log file named "ftplog.log" is created. You can remove " >> ftplog.log" from the script if you don't want the log file.

    3.
    Run the Auto_FTP.bat. Your file will be uploaded to the destination folder on your site

    Note: If you want to upload multiple files, you need to change the "upload.ftp" file code as
    Code:
    open raymond.cc
    username
    password
    cd public_html/downloads
    mput C:\MySite\*.exe
    bye
    Note the mput command instead of put. Change the batch script as
    Code:
    @echo off
    ftp -i -s:"upload.ftp" >> ftplog.log
    Note the extra -i switch in the above code. This will upload all files from C:\MySite having .exe extension.

    Enjoy
    Happy To Help

  2. #2
    Newbie
    Overall activity: 0%

    Join Date
    Dec 2010
    Posts
    2
    Liked
    0 times
    Points
    911
    Salam mas Ray...

    Singkat saja... untuk online saya make pc platform linux, dan kadang saya upload file ke hosting, karena saya gak punya akses root, jd saya gak bisa install ftp. Nah, setelah membaca artikel ini, saya mo tanya, bagaimana implementasi untuk platform linux...

    Mohon bantuannya... terima kasih.

  3. #3
    Whiz Kid
    Overall activity: 0%

    Join Date
    Sep 2008
    Location
    Albania
    Posts
    1,771
    Liked
    80 times
    Points
    20,857
    You must wright in english pal and you should not bump old threads. Thread closed. If you need help related to this topic start a new thread or PM me and I'll re-open it again. Thank You!
    Last edited by Alboguy; 12-19-2010 at 11:00 PM.

    Screw Google! Ask me!


 

 

Similar Threads

  1. Replies: 12
    Last Post: 10-07-2010, 06:12 PM
  2. How to automate windows configuration
    By stackerjush in forum Software
    Replies: 2
    Last Post: 04-15-2009, 12:58 PM

Tags for this Thread

All times are GMT +8. The time now is 09:08 AM.