Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 "", "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

migrated from Feb 14 '12 at 15:35

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

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
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" -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:;. From there, I don't see any examples of uploading. – John Feb 16 '12 at 6:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .