#!/usr/bin/python2 import os profiledir="/build_tools/larch8/larch0/profiles" def getProfileList(profileType): profilelist=[] dirlist=os.listdir(profiledir) for dir in dirlist: if dir.startswith("linhes"): if profileType != "All": if dir.find(profileType) > 0: profilelist.append(dir) else: profilelist.append(dir) return profilelist def SyncTesting(): profilelist = getProfileList("testing") return profilelist def SyncStable(): profilelist = getProfileList("stable") return profilelist def SyncALL(): profilelist = getProfileList("All") return profilelist options = ['Sync Testing', 'Sync Stable', 'Sync ALL'] callbacks = [SyncTesting, SyncStable, SyncALL] for i,option in enumerate(options): print('%s. %s' % (i, option)) # display all options choice = int(raw_input('your choice? ')) profilelist = callbacks[choice]() # call correspondending function for i,option in enumerate(profilelist): print('%s. %s' % (i, option)) # display all options print "" print "\nSync From which profile" choice = int(raw_input('your choice? ')) srcprofile=profilelist[choice] for i in profilelist: if i == srcprofile: continue cmd = 'rsync --exclude pacman.conf.repos --exclude splash.xpm.gz --exclude splash.xpm --exclude vbg.jpg --exclude=pacman.conf --delete -apv %s/%s/ %s/%s/' %(profiledir,srcprofile,profiledir,i) print cmd os.system(cmd)