471,330 Members | 1,463 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

Needed: FTP Upload Directory Tree script

Hi,

Does anyone know of a function or script to upload an entire
subdirectory tree from a local file space to an FTP server?

The Python distribution comes with "ftpmirror.py", which performs
a mirror download of a directory tree, but I need the "Upload"
version of this.

Thanks for any hints
--
-- Ian -- ia**@acm.org ---
Jun 10 '07 #1
2 6715
On Jun 10, 3:01 am, IanC <i...@acm.orgwrote:
Hi,

Does anyone know of a function or script to upload an entire
subdirectory tree from a local file space to an FTP server?

The Python distribution comes with "ftpmirror.py", which performs
a mirror download of a directory tree, but I need the "Upload"
version of this.

Thanks for any hints
--
-- Ian -- i...@acm.org ---
Here's some links that should give you some pointers:

http://zephyrfalcon.org/weblog/arch_...6_28.html#e262
http://www.example-code.com/python/p...ftp-upload.asp
http://www.thescripts.com/forum/thread22534.html

Mike

Jun 10 '07 #2
Hello Ian,

On 2007-06-10 10:01, IanC wrote:
Does anyone know of a function or script to upload an entire
subdirectory tree from a local file space to an FTP server?

The Python distribution comes with "ftpmirror.py", which performs
a mirror download of a directory tree, but I need the "Upload"
version of this.
I'm just working on an ftputil[1] extension[2] to copy/mirror
directory trees between local filesystems and remote FTP hosts.
It's in pre-alpha state (just in development), but maybe it
already does what you want. Did I note that this is an only
slightly tested module and might destroy your files? - That is,
use it at your own risk. I recommend you look at the source
code of ftp_sync.py before using it.

It works like this:

- Download[3] and install ftputil.

- Download the file[2] and put it into the site-packages/ftputil
directory.

- Use the library like:

import ftputil
from ftputil import ftp_sync

source = ftp_sync.LocalHost()
target = ftputil.FTPHost(hostname, username, password)
syncer = ftp_sync.Syncer(source, target)
syncer.sync(source_directory, target_directory)

Note that the _contents_ of source_directory (_not_ the directory
itself) will be copied to the already-existing target_directory.

If you have further questions or feedback, please send e-mail
to the ftputil mailing list[4] or to me[5].

[1] http://ftputil.sschwarzer.net
[2] http://ftputil.sschwarzer.net/trac/b....py?format=txt
[3] http://ftputil.sschwarzer.net/trac/wiki/Download
[4] mailto:ft*****@codespeak.net
[5] mailto:ss********@sschwarzer.net

Stefan
Jun 10 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Philippe Lemmerling | last post: by
3 posts views Thread by dave | last post: by
9 posts views Thread by Wayne Smith | last post: by
7 posts views Thread by ljuljacka | last post: by
1 post views Thread by Oliver Marshall | last post: by
9 posts views Thread by Steve Poe | last post: by
2 posts views Thread by grozanc | last post: by
13 posts views Thread by eclipsme | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.