keep things simpleand store my book support home website as simple directory of files for other sitesthoughincluding one keep at another machinesite transfer scripts are easier to use if they also automatically transfer subdirectories along the way uploading local trees it turns out that supporting directories on uploads is fairly simple--we need to add only bit of recursion and remote directory creation calls the upload script in example - extends the class-based version we just saw in example - to handle uploading all subdirectories nested within the transferred directory furthermoreit recursively transfers subdirectories within subdirectories--the entire directory tree contained within the top-level transfer directory is uploaded to the target directory at the remote server in terms of its code structureexample - is just customization of the ftptools class of the prior section--reallywe're just adding method for recursive uploadsby subclassing as one consequencewe get tools such as parameter configurationcontent type testingand connection and upload code for free herewith oopsome of the work is done before we start example - pp \internet\ftp\mirror\uploadall py #!/bin/env python ""###########################################################################extend the ftptools class to upload all files and subdirectories from local dir tree to remote site/dirsupports nested dirs toobut not the cleanall option (that requires parsing ftp listings to detect remote dirssee cleanall py)to upload subdirectoriesuses os path isdir(pathto see if local file is really directoryftp(mkd(pathto make dirs on the remote machine (wrapped in try in case it already exists there)and recursion to upload all files/dirs inside the nested subdirectory ###########################################################################""import osftptools class uploadall(ftptools ftptools)""upload an entire tree of subdirectories assumes top remote directory exists ""def __init__(self)self fcount self dcount def getcleanall(self)return false don' even ask def uploaddir(selflocaldir)""transferring directory trees with ftplib