- For each folder in a selection of folders:
1. Go to any file in the folder.
2. Extract a property from the file.
3. Suffix the property value to the parent folder
4. Repeat with the next folder in selection.
Working script to get property from 1 file & suffix to dir
-
Jerry
- Posts: 835
- Joined: 05 May 2010 15:48
- Location: The UnUnited States of America
Working script to get property from 1 file & suffix to dir
I'm looking for a working script, or a reusable fragment of a working script (not just an outline of steps), that does the following (which I can then edit further for my particular needs):
Running on Windows 10 Pro 64-bit quad-core ASUS G752-VY notebook with 64 GB RAM, over 26 external USB3 drives attached via multiple powered hubs with letters and mount points, totaling 120+ TB. SCREEN SCALING: 125%
-
highend
- Posts: 14940
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Working script to get property from 1 file & suffix to d
Code: Select all
foreach($folder, <get SelectedItemsPathNames |>) {
if (exists($folder) != 2) { continue; }
$bitrate = regexreplace(property("#audio.bitrate", gettoken(listfolder($folder, , 1), 1, "|")), "[^0-9]");
if !($bitrate) { continue; }
$base = gpc($folder, "component", -1);
renameitem("$base MP3@$bitrate", $folder);
}
One of my scripts helped you out? Please donate via Paypal
-
Jerry
- Posts: 835
- Joined: 05 May 2010 15:48
- Location: The UnUnited States of America
Re: Working script to get property from 1 file & suffix to d
Works perfectly, highend. I just changed it to include a "*.mp3" pattern in the call to listfolder() since there are other non-audio files usually present. Thank you very much!
Running on Windows 10 Pro 64-bit quad-core ASUS G752-VY notebook with 64 GB RAM, over 26 external USB3 drives attached via multiple powered hubs with letters and mount points, totaling 120+ TB. SCREEN SCALING: 125%
XYplorer Beta Club