from shutil import move as mv, copyfile as cp
import pathlib
-def move(indir, outdir, n, distinction_word='', copy=True):# move n ordered files from indir to outdir
+def move(indir, outdir, start=None, end=None, distinction_word='', copy=True):# move start ordered files from indir to outdir
l = sorted(ls(indir))
- for filename in l[:n]:
+ for filename in l[start:end]:
# print(join(indir, filename), join(outdir, filename))
pathlib.Path(outdir).mkdir(parents=True, exist_ok=True)
fname, fextension = splitext(filename)
if __name__ == '__main__':
- move('./generated/90/infarctus/crop-nomask', './sample/train/infarctus', 400, distinction_word="-crop-nomask") # move 400 ordered files from param 1 to param 2
- move('./generated/90/noinfarctus/crop-nomask', './sample/train/noinfarctus', 400, distinction_word="-crop-nomask")
- move('./generated/90/infarctus/crop-nomask', './sample/valid/infarctus', 100, distinction_word="-crop-nomask")
- move('./generated/90/noinfarctus/crop-nomask', './sample/valid/noinfarctus', 100, distinction_word="-crop-nomask")
\ No newline at end of file
+ move('./generated/updated/infarctus/crop-mask', './sample/train/infarctus', 0, 800, distinction_word="-crop-mask") # move [0 -> 600] ordered files from param 1 to param 2
+ move('./generated/updated/infarctus/crop-mask', './sample/valid/infarctus', 800, 1100, distinction_word="-crop-mask")
+ move('./generated/updated/infarctus/crop-mask', './sample/test/infarctus', 1100, 1200, distinction_word="-crop-mask")
+
+ move('./generated/updated/noinfarctus/crop-mask', './sample/train/noinfarctus', 0, 100, distinction_word="-crop-mask")
+ move('./generated/updated/noinfarctus/crop-mask', './sample/valid/noinfarctus', 100, 160, distinction_word="-crop-mask")
+ move('./generated/updated/noinfarctus/crop-mask', './sample/test/noinfarctus', 160, 200, distinction_word="-crop-mask")