INNER CODE UNIT · Python
in_folder
LINBIT/linstor-server · scripts/diffcopy.py:25
def in_folder(name):
return [f for f in os.listdir(name) if os.path.isfile(os.path.join(name, f))]
distinct = [f for f in in_folder(args.FOLDER_A) if f not in in_folder(args.FOLDER_B)]
if len(distinct) == 0:
sys.exit(0)
if not args.dry_run and os.path.isdir(args.TARGET):
for f in distinct:
shutil.copy(os.path.join(args.FOLDER_A, f), args.TARGET)
else:
for f in distinct:
print(os.path.join(args.TARGET, f))