/* --------------------------------------------------------------- */ /* Publish contents of current directory to an FTP domain */ /* --------------------------------------------------------------- */ /* */ /* Copyright (c) Mike Cowlishaw, 2013. All rights reserved. */ /* */ /* Permission to use, copy, modify, and/or distribute this */ /* software for any purpose with or without fee is hereby granted, */ /* provided that the above copyright notice and this permission */ /* notice appear in all copies, and that notice and the date of */ /* any modifications be added to the software. */ /* */ /* This software is provided "as is". No warranties, whether */ /* express, implied, or statutory, including, but not limited to, */ /* implied warranties of merchantability and fitness for a */ /* particular purpose apply to this software. The author shall */ /* not, in any circumstances, be liable for special, incidental, */ /* or consequential damages, for any reason whatsoever. */ /* */ /* --------------------------------------------------------------- */ /* Use as: demoPublish [clean] [force] [trace] */ /* or: demoPublish ? (or /? or help) for help text */ /* */ /* See webPublish.rex header for more details and options. */ dirList='speleo surveys' -- known valid directories rootDir='speleo' -- pseudonym for root at target textTypes='html txt asc' -- filetypes to transfer as text binaryTypes='jpg gif tif png bmp', -- filetypes to transfer as binary 'pdf wav mid' -- filetypes to transfer as binary ignoreTypes='in wiki rex list old log', -- filetypes to ignore quietly 'bak' server='ftp.somewhere.org' -- FTP open address user='caver' -- username password='pothole' -- pw -- Check directory is valid (to avoid accidental merge with some -- other directory) here=filespec('name', directory()) if wordpos(here, dirList)=0 then do say 'This must be called from a directory in this list:' dirlist say 'You are in "'here'" -- exiting' exit 1 end where='www/html' if here\=rootDir then where=where'/'here parse arg args -- pass on call webPublish server'/'where, user':'password,, textTypes, ignoretypes, binarytypes, 'demoPublish' args exit result