Answer the question
In order to leave comments, you need to log in
Automatic placement of photos in folders, really?
Friends, hello everyone!
Please tell me if there is such software that can automatically place photos in the created folders.
Example: There are 1000 photos, I need the program to create a folder and put 15 photos there.
Thank you for your responses.
Answer the question
In order to leave comments, you need to log in
Well damn. I'll give you a formally correct solution to a stupid question.
We create test "photos", a thousand pieces:
py "(f'{i:04}.img' for i in range(1000))" | xargs -n 1 touch
#!/bin/bashbin
# Сама создаёт папку:
mkdir my_folder
# И переносит туда 15 фотографий:
ls *.img | head -n 15 | xargs -n 1 mv -t my_folder
ls *.img | py -l "(p.mkdir(exist_ok=1) or f.rename(p/f) for p, f in ((pathlib.Path(f'{i//15:03}'), pathlib.Path(f)) for i, f in enumerate(l)))"
ls *.img
it lists all the files, and the one-liner in python enumerates the entire list, numbers, creates N / 15 directories (where N is the total number of files), and shoves the files into these directories: from zero (by count) to the fourteenth in "000", with 15 to 29 in "001", etc. py "(p.mkdir(exist_ok=1) or f.rename(p/f) for p, f in ((pathlib.Path(f'{i//15:03}'), pathlib.Path(f)) for i, f in enumerate(sorted(pathlib.Path('.').glob('*.img')))))"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question