Re numbering design files according to its category?

Bulk Rename Utility How-To's

Re numbering design files according to its category?

Postby Jakov » Wed May 12, 2021 12:16 pm

Hi All
after downloading design files from freepik, 365psdfiles ...etc
the files after extracting to a single folder have a sequential number like these (for example and it's not constant):

8352.jpg
8352.ai
SL-010720-26730-58.jpg
SL-010720-26730-58.eps
97056553.png
97056553.psd
jpg, png files are the preview of design files (ai, eps, PSD), so it's linked with it.

My question can I renumber these files by removing the original file name and make new sequential number like these

1.jpg
1.ai
2.jpg
2.eps
3.png
3.psd ..etc

I tried numbering in BRU, but it numbering files at all and numbering each file category does not benefit to me because design files and preview files are linked with each other.

Thanks
Jakov
 
Posts: 37
Joined: Sat May 23, 2020 1:29 am

Re: Re numbering design files according to its category?

Postby therube » Wed May 12, 2021 4:16 pm

Oh, just thinking...

If it is always a "pair" of corresponding files jpg+ai, jpg+eps, png+psd...
If you were to rename only the jpg/png (picture) files, first...
Then rename everything else - excluding the jpg/png files...

So jpg jpg png, becomes 1 2 3, 1.jpg 2.jpg 3.png...

Then do the same with the corresponding files (& excluding jpg/png)...

So ai eps psd, (also) becomes 1 2 3, 1.ai 2.eps 3.psd...

12:Filters allows a JavaScript condition.
And I suppose ? you could negate that condition?
So name.endsWith(!/jpg/) or name.endsWith(!/png/), so jpg & png are not selected (for the second go around)...
(I don't know JS so no clue whether what I [hammered together] above is correct or not? [I'd bet on the not ;-), but that's the idea.])

---

Along with above...

2:Name -> Remove, would remove the name
10:Numbering, would number your files
therube
 
Posts: 1022
Joined: Mon Jan 18, 2016 6:23 pm

Re: Re numbering design files according to its category?

Postby Luuk » Wed May 12, 2021 7:17 pm

I was also going to say much like therube, but only if each design filetype has exactly one preview filetype.
So then using Filters(12) Masks like *ai *eps *psd for the designs, and then *.jpg *.png for the previews.
Sorry, but I cannot help with the javascript that might conduct all of this to be much easier.

I dont believe that bru has options to look at any other files, except the one that its renaming?
But this batch shows how to create some rename commands like your description...

@echo off
Set num=1
cd /d "C:\Your\Folder\Path\"
For /f "delims=" %%A IN ('dir /b *.ai *.eps *psd') DO Call echo ren "%%~nA.*" "%%num%%.*" &Set /a num=num+1
pause

It wont rename anything because using echo, but with files like your description, will present commands like...
ren "8352.*" "1.*"
ren "SL-010720-26730-58.*" "2.*"
ren "97056553.*" "3.*"

So if removing echo, it renames all filetypes (with the same design-filename) to a number like...
8352.jpg ================> 1.jpg
8352.ai =================> 1.ai
SL-010720-26730-58.jpg ===> 2.jpg
SL-010720-26730-58.eps ===> 2.eps
97056553.png ============> 3.png
97056553.psd ============> 3.psd
97777777.jpg ============> ---- (not renamed because no 97777777.ai/.eps/.psd)
98888880.ai =============> 4.ai (lonely because no matching .jpg/.png/.ext)
99999999.ai =============> 5.ai
99999999.jpg ============> 5.jpg
Luuk
 
Posts: 318
Joined: Fri Feb 21, 2020 10:58 pm

Re: Re numbering design files according to its category?

Postby Jakov » Wed May 12, 2021 8:54 pm

therube wrote:Oh, just thinking...


Hhhhhhhh, I thought and tried a billion times but no result
Finally, I conclude that BRU has no ability to do my idea
Thanks bro
Jakov
 
Posts: 37
Joined: Sat May 23, 2020 1:29 am

Re: Re numbering design files according to its category?

Postby Jakov » Wed May 12, 2021 9:02 pm

Luuk wrote:So if removing echo, it renames all filetypes (with the same design-filename) to a number like...
8352.jpg ================> 1.jpg
8352.ai =================> 1.ai
SL-010720-26730-58.jpg ===> 2.jpg
SL-010720-26730-58.eps ===> 2.eps
97056553.png ============> 3.png
97056553.psd ============> 3.psd
97777777.jpg ============> ---- (not renamed because no 97777777.ai/.eps/.psd)
98888880.ai =============> 4.ai (lonely because no matching .jpg/.png/.ext)
99999999.ai =============> 5.ai
99999999.jpg ============> 5.jpg


Thanks billion time Mr. Luuk. Your are awesome
Lastly, Please
according to your speech, BRU has no ability to do my idea, that's correct?
Secondly, from your batch code
Luuk wrote:97777777.jpg ============> ---- (not renamed because no 97777777.ai/.eps/.psd)
98888880.ai =============> 4.ai (lonely because no matching .jpg/.png/.ext)

can you ignore design files (ai, eps, PSD) from numbering if corresponding preview files not present (I mean number 4 from your example)?

Thanks again and again
Jakov
 
Posts: 37
Joined: Sat May 23, 2020 1:29 am

Re: Re numbering design files according to its category?

Postby Luuk » Wed May 12, 2021 11:18 pm

Yes, but you would have to edit the For-line with an If command to first look for preview files, so something like...
For /f "delims=" %%A IN ('dir /b *.ai *.eps *psd') DO If exist "%%~nA.??g" (Call echo ren "%%~nA.*" "%%num%%.*" &Set /a num=num+1)

After finding any design-extension, it would then look for any same-named previews with .??g extension (to find either .jpg or .png)
If not finding any previews, the design-extension would not be renamed, and the counter would only increment when finding matched pairs.
Luuk
 
Posts: 318
Joined: Fri Feb 21, 2020 10:58 pm

Re: Re numbering design files according to its category?

Postby Luuk » Thu May 13, 2021 1:17 am

Sorry I forgot to answer your question, but I dont know of any options for bru to look at another file, besides the one its renaming.
There might be ways to conduct this same batch logic inside the javascript, but Im no ideas about how the code should look like?
Also, to forbid renaming the lonely project-files without preview-files, the whole batch to look like ...

@echo off
Set num=1
cd /d "C:\Your\Folder\Path\"
For /f "delims=" %%A IN ('dir /b *.ai *.eps *psd') DO If exist "%%~nA.??g" (Call echo ren "%%~nA.*" "%%num%%.*" &Set /a num=num+1)
pause

After finding a design-file, it looks for previews by looking for SameName.??g extensions (to find either .jpg or .png)
If not finding previews, the design-file is not renamed, and the counter only increments when finding matched pairs.
Luuk
 
Posts: 318
Joined: Fri Feb 21, 2020 10:58 pm

Re: Re numbering design files according to its category?

Postby Jakov » Thu May 13, 2021 4:10 am

Luuk wrote:Sorry I forgot to answer your question, but I dont know of any options for bru to look at another file, besides the one its renaming.
There might be ways to conduct this same batch logic inside the javascript, but Im no ideas about how the code should look like?
Also, to forbid renaming the lonely project-files without preview-files, the whole batch to look like ...


Don't worry my bro
That's enough to me, you saved my time because I have 350GB of such design files
May God protect you
Billion Thanks for you
Best Regards
Jakov
 
Posts: 37
Joined: Sat May 23, 2020 1:29 am

Re: Re numbering design files according to its category?

Postby Luuk » Thu May 13, 2021 3:29 pm

With 350GB, I would first verify that all preview extensions are either .png/.jpg (but never .jpeg).
You can verify this on the command-line by typing dir /b /s *.jpeg to see if you have any of them.

The batch only seeks 3-character extensions, so design-files with .jpeg previews are conducted as lonely (design-file and preview not renamed).
You could rename all .jpeg ==> .jpg, or just edit the batch by changing .??g ==> .*g so then matching any extension that ends with 'g'.
Luuk
 
Posts: 318
Joined: Fri Feb 21, 2020 10:58 pm

Re: Re numbering design files according to its category?

Postby Luuk » Thu May 13, 2021 6:48 pm

After thinking about this, I would probably NOT edit .??g ==> .*g just in case I had names like...
SomeName.ai
SomeName.png
SomeName.PlusMoreText.eps
SomeName.PlusMoreText.jpg

Because then .*g would let the rename commands group them together, having same number.
So its better to rename .jpeg ==> .jpg, and if you need to add more preview extensions, let me know.
Luuk
 
Posts: 318
Joined: Fri Feb 21, 2020 10:58 pm

Re: Re numbering design files according to its category?

Postby Jakov » Fri May 14, 2021 8:14 pm

Luuk wrote:With 350GB, I would first verify that all preview extensions are either .png/.jpg (but never .jpeg).

No No Mr Luuk, That's enough and I will work folder by folder in an organized way.
Also, If needed I will convert file format for preview files to jpg or png.
But, I think that almost all preview files are either jpg or png.
Again you saved my time, thanks a lot.
Take your rest my bro.
Best Regards.
Jakov
 
Posts: 37
Joined: Sat May 23, 2020 1:29 am


Return to How-To