def delete(rsync, directory):
    empty = (tempfile.mkdtemp() + os.path.sep)
    command = [rsync, '-v', '-r', '--delete', empty, directory]
    subprocess.check_call(command)
    os.rmdir(directory)
    os.rmdir(empty)
def delete(rsync, directory):
    empty = (tempfile.mkdtemp() + os.path.sep)
    command = [rsync, '-v', '-r', '--delete', empty, directory]
    subprocess.check_call(command)
    os.rmdir(directory)
    os.rmdir(empty)