files = expand_glob(sys.argv[1:],data) junk = [] for s in data: # loop over deleted file names if header.to_lower(s['name']) in files: restore.append(s) else: junk.append(s) header.write_trash(junk,mode='w') for s in restore: if os.path.exists(s['org_path']): # original folder still exists if header.file_exists(s['org_path'],s['org_name']): junk = os.path.join(s['org_path'],s['org_name']) choice = raw_input('Warning! "%s" exists. Overwrite (y/N)?' %junk) if choice[0].lower=='y': temp = header.do_match(junk) os.system('rm "%s"' %temp) restorefile(s) else: print 'Skipping "%s"' %s['org_name'] header.write_trash([s]) else: restorefile(s) else: choice = raw_input('Folder "%s" does not exist. Would you like me create it?' %org_path) if choice[0].lower() == 'y': os.mkdir(path) restorefile(s) else: print "Cannot restore %s to folder %s. The folder does not exist. Skipping" \ %(s['org_name'],s['org_path'])
#!/usr/bin/env python # This script is used to match case for input arguments. It is # used by go.csh to attempt to find a proper match for a user's # input directory name. All the real work happens in the # header.py file. import os,sys,header if __name__ == "__main__": junk = header.do_match(sys.argv[1]) if junk == '__nomatch__': junk = header.getbkmark(header.bookdata,sys.argv[1]) print junk