#!/usr/bin/env python # This script copys the camel snapshot xsd files that publish to the m2 repository to the # camel web site import fnmatch import os import sys import shutil def copy_latest_released_xsds(src, target): for root, dirs, files in os.walk(src): files.sort(); filename = 'NULL' dirname = ''; for file in files: # skip the none xsd file if not fnmatch.fnmatch(file, '*.xsd'): continue # skip the snapshot file if fnmatch.fnmatch(file, '*-SNAPSHOT.xsd'): continue # we don't want copy the target file if file != target : filename = file # get the lastest released xsd file if filename == 'NULL': continue srcfile= os.path.join(root, filename) destfile = os.path.join(root, target) shutil.copyfile(srcfile,destfile) def main(): if len(sys.argv) < 3: print 'copy_released_xsd.py SRC TARGET'\ 'copy the last released xsd file from SRC directory to the TARGET file in SRC directory' sys.exit(); copy_latest_released_xsds(sys.argv[1], sys.argv[2]); if __name__ == '__main__': sys.exit(main())