Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to upload(and eventually overwrite) the same index.php file to many domain folders. Is there anyway to do this in one go or a shortcut?

I am using Filezilla.



Since I am really a newbie on FTP commands, I managed to find an ftp program that help me achieved what I wanted. It's called PyroFTP. It had a sample script that I could follow, and eventually I ended up with something like this and simply executing it:

Connect "ftp.site.com", "username", "password"

LocalChDir "D:\folder"

RemoteChDir "public_html/domainfolder1"
Put "file.txt"

RemoteChDir "../domainfolder2"
Put "file.txt"

RemoteChDir "../domainfolder3"
Put "ifile.txt"

share|improve this question
add comment

migrated from serverfault.com Feb 14 '12 at 15:35

This question came from our site for professional system and network administrators.

2 Answers

Windows answer

This is essentially providing a working script for music2myear's answer, but not for FileZilla.

I used to do this using a batch script and a program called NcFTP - FileZilla likely did not support command line at the time since I was using it for everything else. It should be quite easy to modify for FileZilla, if you want.

@FOR /F "eol=; tokens=1,2,3,4" %%A IN (ftpdetails.txt) DO call ncftpput -u %%A -p %%B %%C %%D %1

It would take destinations from a text file (ftpdetails.txt) with the following format:

username password ip destinationfolder ; comment
username2 password2 ip2 destinationfolder2 ; comment2

This modified version would open every destination in parallel, but risks flooding:

@FOR /F "eol=; tokens=1,2,3,4" %%A IN (ftpdetails.txt) DO start ncftpput -u %%A -p %%B %%C %%D %1

Usage was just dragging the file I wanted to upload on top of the batch file. %1 could be replaced with a filename to upload by opening it. As it is, spaces would break it.

share|improve this answer
add comment
filezilla.exe -u “c:\ftp\TestFile.txt” ftp://ftp_user:ftp_password@ftp_host_ip/folderpath -close

Filezilla can be scripted. If you're using Windows, it's built-in FTP can also be scripted.

Just put together a script that moves the file to all the desired hosts and run it when you update the index file.

Scripting instructions

When you want to automate tasks with programs that accept command line arguments, scripting is how you do it.

You will need the following information:

  • The full path to the file you wish to upload.
  • The username, password, server IP address or domain name, and folder path to the files that need to be updated.

The "Remote Site" is for if you've set up a connection profile for each server in FileZilla. You can call the connection profile by name and thus avoid having to enter the username, password, server, and path for each connection. Looking at the documentation though, I think entering the information is easier and more clear.

In FileZilla, create a connection profile for each server you wish to upload the file to.

Open Notepad. Enter the following text changed for your specific settings and needs. Save the file as (whatever name you want).bat.

filezilla.exe -u "<full path to the file on your computer>" ftp://username:password@server/path -close

Add as many copies of this line as you need: one for each of the files you're updating.

Bob's answer shows how you can use loops and a source file to automate much of this process. It's a lot more difficult to understand the syntax of the loops, but his solution does the same thing and may be easier to manage if you have to update a large number of servers.

share|improve this answer
I have no background in scripting. How do I go about this? Should I create a script file(.vbs?) and paste the above code there? Also what is "Remote Site"? –  John Feb 15 '12 at 13:06
Not VBS. You'll want to do this in Batch script, which is a .bat file. Batch scripting it merely stringing together command prompt commands and their arguments. VBS uses VB commands, which aren't the same. –  music2myear Feb 15 '12 at 14:15
Currently I have filezilla.exe -u "d:\file.txt" ftp://username:passowrd@www.mysite.com/public_html/domainfolder -close in a .bat file. But how to execute? I tried pressing enter, just a flash of the command prompt appears. I ran command prompt and execute the file and it said that 'filezilla' is not a recognized command... –  John Feb 15 '12 at 19:44
Put the full path to the filezilla executable in there. Windows apparently doesn't know where to look for that. It should be something like "C:\Program Files\FileZilla\FileZilla.exe". Because there are spaces in the path, you'll need to enclose it in quotes so the command processor recognizes it is one argument. –  music2myear Feb 15 '12 at 22:05
It runs in the command prompt, but it says "unknown option -u". Then it opens up a dialogue box about filezilla arguments which is the same here: wiki.filezilla-project.org/Command-line_arguments_(Client);. From there, I don't see any examples of uploading. –  John Feb 16 '12 at 6:24
show 1 more comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.