A
A
Anatoly Kachugarov2020-03-10 10:26:49
Automation
Anatoly Kachugarov, 2020-03-10 10:26:49

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

2 answer(s)
S
Sergey Pankov, 2020-03-10
@trapwalker

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

And here is our program:
#!/bin/bashbin
# Сама создаёт папку:
mkdir my_folder
# И переносит туда 15 фотографий:
ls *.img | head -n 15 | xargs -n 1 mv -t my_folder

As you can see, everything is possible.
On what OS?
What is the principle to choose 15 photos out of a thousand?
With what name should the directory be created?
What, one directory?
Why 15 files? Always 15? Ok, 15 so 15.
Well, what kind of people, maybe they are all telepaths, but I'm the only one such a freak that I can't read other people's thoughts at a distance?
UPD.
I won't even correct the typos. Directly to shaking infuriates such a statement of questions.
It seems that the author is too lazy to even re-read his question before posting, and not something to google and think for a second!
UPD2.
Well, ok, in the comments, the author of the question mentioned (accidentally, it seems) that he needs to shove all the files into folders of 15 pieces.
Here you go:
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)))"

Here ls *.imgit 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.
UPD3.
Well, ok, for Windows it will be something like this (there is nothing to try, but it should work):
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')))))"

K
Kelv13, 2020-03-10
@Kelv13

If for Windows, then there is such a program FolderAxe

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question