Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-23-2005, 07:18 AM   #1
john lee
Registered: Jun 2001
Location: Sydney, Australia
Posts: 42

Rep: Reputation: 15
FTP Server Question

Hi all,

We have a few guys in the office who need to upload files regularly to a rather slow ftp server on the Internet.

So, instead of tieing up their client machines to do the upload, I am thinking of setting up an internal ftp server inside the office which they could upload their files quickly. After the files are uploaded, the internal ftp server can then upload all the files to the Internet server slowly on its own.

Are you aware of any such program available or do I have to write my own?

Thanks in advance and have a less stressful Christmas!
Old 12-23-2005, 08:48 AM   #2
LQ Guru
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,243
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
All I see are commercial implementations such as this program can scan a directory and when it sees new files in the directory that can trigger a process to occur, such as uploading the files to another location.

I'm sure there are free solutions out there but I'm not finding them at the moment, I'm thinking you could write a script to do this yourself as well..

here's an example I found..
Here's a shell script to do the entire thing -- hopefully I've understood all your requirements correctly.


# This script assumes that the files you want to transfer are in a
# directory called /mypath/mydirectory, the directory you want to archive
# them to is /mypath/myarchivedir, the remote machine you want to connect
# to is called remotehost, your login to that machine is username
# with password password, and you want to put the files in a directory
# called /remotepath/remotedirectory -- you should replace these with
# the appropriate information, of course. It's also assumed that you
# want to transfer/remove ALL files in the source directory.

# All log information for this process is directed to the file
# log$$.log in the /mypath/myarchivedir directory -- $$ is the shell
# variable for the process ID of the current process, so the file will
# be named something like log12345.log. This is a simple way to create
# a fairly unique filename for the log.

# Check to see if the directory is empty by checking to see if the
# result of an ls of the directory is null. If so, write a message
# out to the log and exit.

if [[ -z `ls /mypath/mydirectory` ]]; then
echo "Directory empty, exiting." > /mypath/myarchivedir/log$$.log

# Write the contents of the directory out to the log.
ls -lt /mypath/mydirectory >> /mypath/myarchivedir/log$$.log

# Copy the contents of the source directory to the archive
# directory, using the -p option to preserve file modification times.
cp -p /mypath/mydirectory/* /mypath/myarchivedir

# Connect to the machine remotehost via ftp using these flags:
# -i Turns off prompting so that multiple files can be transferred
# without user intervention.
# -n Turns off checking for automatic logins set up in .netrc.
# -v Turns on verbose mode.
# Standard output from the ftp command is appended to the log file;
# standard error is also sent to the log file using 2>&1.
# The << symbols after the command indicate the beginning of a "here
# document" -- a section of text that is to be sent to output exactly as
# written. The END after << signifies that the end of the here document
# will be at the next appearance of END.
# Within the here document are the commands to be sent to the ftp server:
# user username password Logs in to the server as user username
# with password password.
# lcd /mypath/mydirectory Changes to the local directory containing
# the files to be uploaded.
# cd /remotepath/remotedir Changes to the remote directory the files
# are to be transferred to.
# mput * Transfers all files in the current local directory.
# close Closes the connection to the server.
# bye Exits the ftp process.

ftp -inv remotehost >> /mypath/myarchivedir/log$$.log 2>&1 << END
user username password
lcd /mypath/mydirectory
cd /remotepath/remotedir
mput *

# Remove all files in /mypath/mydirectory once they've been transferred.
rm /mypath/mydirectory/*


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a way to carry out 'ftp' from Linux to Windows without using tool like Filez nidugala Linux - Networking 2 12-09-2005 09:16 AM
A dns server question adrianmak Linux - Software 3 09-19-2005 11:24 PM
X server question fictos Debian 1 07-31-2005 12:47 PM
VPN Question Win98->internet->Router->Linux VPN Server->Win2k Server patrickrea Linux - Networking 1 08-10-2004 02:09 AM
Moving from Server to Server Question Amaris4GOW Linux - General 8 07-20-2003 09:18 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:39 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration