Page 1 of 1

Put files into folders based on file name

PostPosted: Sun Jun 05, 2022 2:36 am
by Morbeas
Hey there. I have some folders with pictures in them. The issue is that the file dates and EXIF data is a mess or non-existent.

Most pictures, however, have the date in the filename, like so: IMG-20180512-WA0001.jpg

Let's say the current path of the file is this: M:\Photos\iCloud\2022\06-June\IMG-20180512-WA0001.jpg

Based on the filename, would it be possible to move the file so it resides here (this folder may or may not exist, so it would have to be created if not)? M:\Photos\iCloud\2018\05-May\IMG-20180512-WA0001.jpg

Thank you very much.

Re: Put into folders based on filename

PostPosted: Sun Jun 05, 2022 5:07 am
by Luuk
First to put a checkmark inside for the menu "Renaming Options, Advanced Options, Allow Using \ in Renaming Criteria".
Then RegEx(1) needs a checkmark inside "v2", so then your "Match" and "Replace" could look something like...
^IMG-((?:19|20)\d\d)(0[1-9]|1[012])\d\d-WA\d+$
..\\..\\$1\\$2\\$0

This does only make the month-folders like...
M:\Photos\iCloud\2022\06-June\IMG-20180512-WA0001.jpg ===> M:\Photos\iCloud\2018\05\IMG-20180512-WA0001.jpg
M:\Photos\iCloud\2022\06-June\IMG-20191211-WA0001.jpg ===> M:\Photos\iCloud\2019\12\IMG-20191211-WA0001.jpg


If needing month-folders with words, then first must decide on all of the spellings below, then use a Match and Replace more like...
^IMG-((?:19|20)\d\d)(0[1-9]|1[012])\d\d-WA\d+$(?X):01(?X):02(?X):03(?X):04(?X):05(?X):06(?X):07(?X):08(?X):09(?X):10(?X):11(?X):12
..\\..\\$1:$2\\$0(?X)\\01-Jan(?X)\\02-Feb(?X)\\03-Mar(?X)\\04-Apr(?X)\\05-May(?X)\\06-Jun(?X)\\07-July(?X)\\08-Aug(?X)\\09-Sep(?X)\\10-Oct(?X)\\11-Nov(?X)\\12-Dec

This to make the month-folders like...
M:\Photos\iCloud\2022\06-June\IMG-20180512-WA0001.jpg ===> M:\Photos\iCloud\2018\05-May\IMG-20180512-WA0001.jpg
M:\Photos\iCloud\2022\06-June\IMG-20191211-WA0001.jpg ===> M:\Photos\iCloud\2019\12-Dec\IMG-20191211-WA0001.jpg

Re: Put into folders based on filename

PostPosted: Sun Jun 05, 2022 2:53 pm
by Morbeas
Thank you so much for this! I'll be sure to give it a try when I get home! Much appreciated!

Re: Put into folders based on filename

PostPosted: Sun Jun 05, 2022 6:51 pm
by Luuk
Both of the solutions depend on having filenames like in the example, and they must be settled exactly 2-folders below \iCloud\.
This can be modified with other settings, especially if some files might be settled at different folder-depths below \iCloud\ ?

Re: Put into folders based on filename

PostPosted: Sun Jun 05, 2022 10:05 pm
by Morbeas
Luuk wrote:Both of the solutions depend on having filenames like in the example, and they must be settled exactly 2-folders below \iCloud\.
This can be modified with other settings, especially if some files might be settled at different folder-depths below \iCloud\ ?


Yessir, thank you! I was able to figure out and tweak your settings for other files as well. Everything worked perfectly! Thanks again very much!