How to rename a file in finder?
Hi there,
I'm having trouble figuring out how to rename a file in the finder using SoundFlow. Is there a way to do this with a SoundFlow macro I'm overlooking, or through scripting?
For context of what I'm up too...I made a modified version of Andrew Scheps' automated bounce script (thanks for sharing the guts of that script Andrew!) and I'm trying to rename the 16 bit 44.1 version of the file once the bounce is complete.
I like to include the sample rate and bit depth of a mix in the name of my mix file, so one of the tweaks I made to the script was to have the script follow my little naming convention when it incriments the playlist....so, for example the script names the playlist and the bounce:
"BandInitials_SongName_48k24_TodaysDate_NKMix_v1"
When the script Exports clip as File to make the 16bit 44.1 version, the export uses the clip name which always has "48k24" in the name.
Right now I have the script end by opening my folder of 44k16 Refs, and then I just manually rename the 16bit file and change "48k24" to "44k16" I'm hoping there is some way to automate that last little remaming step.
Thanks for any sugestions,
nick
- Kitch Membery @Kitch2020-11-11 04:21:22.285Z
Hi @nick_krill,
I'm sure @Andrew_Scheps will chime in, but till then, here ya go;
function main() { const oldFileNamePath = '~/Desktop/Old File Name.wav'; const oldFileDirectoryPath = oldFileNamePath.split('/').slice(0, -1).join('/').toString(); const bandInitials = 'NKOTB' const songName = 'The Right Stuff' const todaysDate = yyyymmdd(); const newFileNamePath = `${oldFileDirectoryPath}/${bandInitials}_${songName}_48k24_${todaysDate}_NKMix_v1.wav`; sf.file.move({ sourcePath: oldFileNamePath, destinationPath: newFileNamePath, }); } main();
- In reply tonick_krill⬆:Christian Scheuer @chrscheuer2020-11-11 08:33:52.503Z
To get the name of the currently selected file in Finder, you can do this:
let path = sf.ui.finder.firstSelectedPath; log(path);
Kitch has shown some code on how to do a rename - essentially, use
sf.file.move
and give it the source and destination paths.However, in your case, I wouldn't use the Finder approach at all, but rather, since you already know the full path of the bounced files, just rename them directly.
The Finder approach should be used only when actually wanting the user to perform a change to what they have selected manually in Finder.- Nnick krill @nick_krill
Hi @Kitch and @chrscheuer,
Thank you both for the tips, I think I got something working!
Yeah, turns out I could use some variables in my main script to make pointing to the paths and also the desired final 16bit 44.1 file name pretty simple!
Phew, Christian, I keep being amazed by just what SoundFlow can do....and I know I am still just scratching the surface!
-nick
Kitch Membery @Kitch2020-11-18 00:09:20.610Z
Nice one @nick_krill!!!