Esempio n. 1
0
def unarchive(archive_path, target_dir, logdir):
	command  = [ 'tar' , '-xzf' , archive_path , '-C' , target_dir ]
	res = execute.command(command, logdir)
	if res['returncode'] == 0:
		return target_dir
	else:
		return None
Esempio n. 2
0
def archive(archive_path, prefix, logdir):
	files = map(lambda f: f.split('/')[-1], glob.glob('{}*'.format(prefix)))
	command  = [ 'tar' , 'czf' , archive_path , '-C' , os.path.dirname(prefix) ] + files
	res = execute.command(command, logdir)
	return res['returncode'] == 0