Hi,
I have 100s of files containing paths to soundfiles that I would like to change. They are made with Object.writeArchive
and look something like this:
var o, p;
o = [
Array.prNew(6), Array.prNew(37), "/Volumes/MEDIA/sounds/snd1.wav", "/Volumes/MEDIA/sounds/snd2.wav", ...
etc, etc
Would anyone recommend me an app or terminal command for MacOS to replace the strings of the directory with new ones for all the files at once?
Sounds like a job for sed.
IIRC its default mode is to replace only the first occurrence in a line – there’s a switch to make it replace all – use that. Also do use the option to keep a backup of the original file, just in case – you can delete backups later, but if your first-try sed expression messes up the contents, you’ll need the backups.
hjh
2 Likes
Whatever you use, use it once.
Replace the path with
“~root” (or whatever seems like a good name to you) then search and replace to get
var src = ~root ++ "filename.wav"
then put
~root = "/whatever/location/you/choose";
at the start of your code.
That was you can change the location as often as you like.
(
If you put the files in a folder where the code files are kept, you can use this
~root = (PathName(thisProcess.nowExecutingPath).parentPath ++ folder_name)
to automate the root location relative to wherever you put your project
)