By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,759 Members | 1,778 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,759 IT Pros & Developers. It's quick & easy.

Needed: FTP Upload Directory Tree script

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.