Answer the question
In order to leave comments, you need to log in
How to sort files in directories by date?
There is a system with Debian on board, a camera is connected. Motion in the presence of movement in the directory / home / user / motion_files removes jpg with a certain frame rate. It is necessary to sort files in such a way that folders are created in the current directory: /home/user/motion_files/files/(year)/(month)/(date)/
And *.jpg files are sorted accordingly.
Answer the question
In order to leave comments, you need to log in
move.sh
path=/home/user/motion_files/files/$(date +%y -r $1)/$(date +%m -r $1h)/$(date +%d -r $1)
mkdir -p $path
mv $1 $path
find -name *.jpg -exec move.sh {} \;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question