#1 : 14/10-24 11:38 Rafo
Posts: 6
|
Very nice software!
I already did some advanced renaming, but it would be great to move photos (images, raw files, whatever) in the /photos subfolder. Same goes for video and audio. I need that to manage video projects, where a subfolder structure like: project/videos project/photos project/audio project/documents is very helpful. Currently, it appears to be impossible without JS, since there are no "metatags" like isImage, isVideo... and no IF conditions for moving files, am I right? |
#2 : 14/10-24 13:55 Styb
Posts: 117
|
Reply to #1:
Hi, you can use the Mark command in the file list context menu to move files to a folder of your choice based on their extension. 1) Import the files 2) Right click on the file list -> Mark -> Mark None 3) Right click on the file list -> Mark -> Mark by pattern In the pattern window, eg. for the image files, enter (jpg|png|psd|heic) and check "Use regular expression", so that only the image files are marked. Finally, you can run the batch to move the marked files to the desired folder. You can repeat for video or document files based on their extensions. |
#3 : 14/10-24 14:45 Delta Foxtrot
Posts: 323
|
Reply to #2:
Hi Rafo, welcome, Hey Styb, good information as always buddy. I just wanted to say, if you want to do it all in one shot you could modify and use the following simple script. It should be pretty self-explanatory and, as long as the files are in the directory you want the subfolders to be created or used in it will do the trick (it doesn't matte if the subfolders are already there or not, it will use them if they are or create them if not). The only thing you'll have to do is add and/or subtract "case" statements at the right place (above the code block that actually assigns a new path for that type of file). In other words, if you wanted to add, for example, .psd files to the "photos" directory you'd just add the line case "psd": in with the other photo cases that don't have code associated with them. Since there's no code with the case the script just goes down and executes the first code after the case that got the match. Anyway, here's the script: // !!!! NOTE: TURN OFF FILE PAIR RENAMING ON THE OPTIONS MENU!!!! // (Tested on v3.95 and v4.03 only) // ------------------------------------------ Ext = item.ext.substr(1).toLowerCase() ; Path = item.path ; switch ( Ext ) { // photo section: case "raw": case "jpg": case "jpeg": case "png": item.newPath = Path + "photos"; break; // audio section: case "wav": case "mp3": item.newPath = Path + "audio"; break; // video section: case "mp4": case "mov": item.newPath = Path + "videos"; break; } // ------------------------------------------ EDIT: I just noticed you had a documents section also, but just copy and paste one of the patterns that starts with "case" and ends with "break;" and replace the old file extensions and subfolder name with the new information. Or if you want to leave a list of the file types you use I'd be glad to redo the whole thing (but that's probably not necessary... maybe if you run into trouble?). Here's a screenshot, because the code gets uglified in this editor: https://drive.google.com/file/d/1bH2GLpC1fLqEDHX _tT_PsuT4wQowkXar/view?usp=sharing END EDIT You can just add a script method to any batch you use to rename media files, or even use it alone on files you've already renamed. Or don't use it! :) Best, DF |
#4 : 14/10-24 21:49 Rafo
Posts: 6
|
Reply to #2:
Reply to #3: I had a lengthy reply, but the forum killed it because it logged me out? Now I will keep it short: #2 Thanx a lot for pointing me to the mark function. Didn't know it until now. #3 Thanx for your solution. I can work with that. The problem is that there are many file extensions for video and images. I had a lengthy regex somewhere that captures many but not all. How about something like (I am more into python and C++ and dont know JS): From your example I take the "item" const blob = new Blob([item], { type: 'image/jpeg' }); if (blob.type.startsWith('image/')) { item.newPath = Path + "photos"; } else if (blob.type.startsWith('video/')) { item.newPath = Path + "videos"; } else if (blob.type.startsWith('audio/')) { item.newPath = Path + "audio"; } else { citem.newPath = Path + "documents"; } An even better solution could be to serve all file related tags in one tab: Rename the tag tab "Filesize" to "File" Add the Checksum tags to the "File" tab Add a Filetype tag I am sure AR is already checking the filetype somewhere? But I am going too far here. :-D I know this solution would not be enough. Users want to have other names for the returned filetype, there is no IF..ELSE UX and you will need JS again and so on... But thank you to both of you for fast and helpful answers! |
#5 : 15/10-24 05:07 Delta Foxtrot
Posts: 323
|
Reply to #4:
Hi Rafo, I don't know about all that, but here's a script that seems to work in v3.95 - at least on all the file types I could come up with on short notice. It uses the <Exiftool:mimetype> tag so it should be right for many file types you work with. Check it out if you want, but I'd suggest previewing with the New Path field showing to check before you jump. In v4.03 that tag seems to work on everything I tried *except* .pdf files, so I had to change it a little to work there. Again, don't know how other file types might react. I use LibreOffice and don't really have MS Office files, or a lot of other types, lying around. Here are the two versions: // -----------{ VERSION 3.95 }------------- t = app.parseTags("<exiftool:MIMEType>") ; Path = item.path ; const retType = "x"; if ( t.indexOf( "image" ) >= 0 ) { item.newPath = Path + "photos"; } if ( t.indexOf( "audio" ) >= 0 ) { item.newPath = Path + "audio"; } if ( t.indexOf( "video" ) >= 0 ) { item.newPath = Path + "videos"; } if ( t.indexOf( "text" ) >= 0 || t.indexOf( "spreadsheet" ) >= 0 || t.indexOf( "pdf" ) >= 0 ) { item.newPath = Path + "documents"; } // ------------------------------------------- (Intermission) // -----------{ VERSION 4.03 }------------- t = app.parseTags("<exiftool:MIMEType>") ; Path = item.path ; Ext = item.ext ; isPDF = ( Ext.toLowerCase() == ".pdf" ) ; const retType = "x"; if ( t.indexOf( "image" ) >= 0 ) { item.newPath = Path + "photos"; } if ( t.indexOf( "audio" ) >= 0 ) { item.newPath = Path + "audio"; } if ( t.indexOf( "video" ) >= 0 ) { item.newPath = Path + "videos"; } if ( t.indexOf( "text" ) >= 0 || t.indexOf( "spreadsheet" ) >= 0 || isPDF ) { item.newPath = Path + "documents"; } // ------------------------------------------ You didn't ask, but personally I'd use the first version and explicitly enter the file type case statements. It may be more work up front (but really simple to do), but with this version you may find your workflow interrupted having to figure out what to do with renegade file types that don't conform to the pattern. PLUS the Exiftool calls are probably a lot slower, so if you work with lots, like tens of thousands, of files like I sometimes do that might be a consideration. Anyway, just food for thought. Best, DF |
#6 : 16/10-24 10:49 Miguel
Posts: 147
|
Reply to #3:
Nice script. You are a real máster. I think i will use It many times. I have a request. Do you think that, instead of move the files would be possible use copy sou you can Add files from.differents folders and set a destination fólder. Miguel |
#7 : 16/10-24 12:46 Delta Foxtrot
Posts: 323
|
Reply to #6:
Hey Miguel, long time no talk, Just to be clear, I'm no master. I know a little, and I'm pretty good at teasing what I know into a reasonably useful package. :) As to copying, I don't think that's possible. There's no command(s) in this javascript that I know of to tell ARen to do that (though again, I'm no expert… could be someone will come along and show us a way to do it, but in my level of understanding I can't think of a way). I'm not sure I even know what you mean. Do you want to leave the original files in their original locations and just move a copy to the new directories? As the script stands now it moves the files to an appropriate subdirectory *under* whatever folder it starts in, so if you have, say, photos from multiple directories in the files list they will end up in sub-folders of the original folders. If you're doing a lot of files all together from different folders you could turn around and load them into a new instance and use the copy mode to copy all the files in those subfolders with the Output folder set to ../ to copy them back where they started. That's about as close to your question as I think I can come. Anyway, thanks for the compliment and I hope it works well for you. Maybe Kim will add a internal command like "item.copyPath" in the future that would leave the original and put a copy out to the new path, but I think he's a little busy right now. :) Best regards, DF |
#8 : 16/10-24 13:42 Miguel
Posts: 147
|
Reply to #7:
Hi, DF dixit: .."I'm not sure I even know what you mean. Do you want to leave the original files in their original locations and just move a copy to the new directories? " Yes, that was my intention but i have found that you can set your own path, even in different drive and it work nicely and work with files from different folders withouth any problem. // ------------------------------------------ Ext = item.ext.substr(1).toLowerCase() ; Path = "X:/My own path/My subfolder/" ; // Config here your own path. switch ( Ext ) { // -------- https://drive.google.com/file/d/1rXAvsthqc9QaU4A e5TnTJm_1k8R42hR0/view?usp=drive_link So thanks for your incredible work. Miguel |
#9 : 16/10-24 13:58 Delta Foxtrot
Posts: 323
|
Reply to #8:
Ah, sure, I just didn't think about doing it that way because I didn't want to confuse the issue. But yeah, you can set one path for all the files of course. See, it's just a skip and a jump, and before long you'll be churning out javascript too! :) Cheers, DF ps: Since I looked at your screenshot I can't get "Riders in the Sky" out of my head! LOL |
#10 : 17/10-24 11:30 Miguel
Posts: 147
|
Reply to #9:
Hi again, I have discovered that if you select as "Batch mode: Copy" it work the way i wanted. :) Cheers, Miguel. PS. I told you some time ago that i was a little bit fussy. |
#11 : 17/10-24 12:06 Delta Foxtrot
Posts: 323
|
Reply to #10:
WOW! That's brilliant. Who's the master now???? :) Makes perfect sense, now that I think about it. You're just telling ARen to leave the original in place, Then whatever you do with setting a new path, the original remains. I don't think I would *ever* have thought of that. Didn't I say, someone smart would come along and show us a way to do it? :)) Best, buddy, DF |
#12 : 19/10-24 08:08 Kim Jensen
Administrator
Posts: 929 |
Advanced Renamer does group media files into 5 groups for internal use: Images, Videos, Audio, Documents and Other. It is very easy for me to expose this grouping as a renaming tag.
Only problem is that some extensions, like MP4, may belong to multiple groups. In that case video will have priority. |
#13 : 21/10-24 21:28 Rafo
Posts: 6
|
Reply to #12:
Showing those groups as a renaming tag. would be perfect! Right now, I am having the problem that I need to add durations, but that only makes sense for Video. So I would appreciate it if those tags could also work under the IF conditions like: Field: Type | Is Video |
#14 : 22/10-24 01:38 Delta Foxtrot
Posts: 323
|
Reply to #13:
Rafo, You can add <Duration> to any file type. If it's a file without a duration nothing will be added. Use a delimiter like #<Duration> at the end of the filename, then add a replace method (regex checked) that replaces \#$ with nothing. DF |
#15 : 01/11-24 14:37 Rafo
Posts: 6
|
Reply to #12:
Fantastic! Do you plan to add this to a release in the future? |
#16 : 03/11-24 08:55 Kim Jensen
Administrator
Posts: 929 |
Reply to #15:
Yes, version 4.06. Hopefully to be released next week. |