I'm trying to automatically re-locate files, and am running into a wall. I can execute the terminal command to find the file which works well in the terminal, but doesn't seem to return any sort of result when run within SoundFlow.
Any other ideas for doing this?
Kitch Membery @Kitch2020-08-21 06:53:36.547Z2020-08-21 08:57:47.651ZAndrew,
I'm not totaly sure this will answer your questions exactly but it might lead to a discovery.
//Folder Path const folderPath = '~/Desktop/'; //File Extension const fileExtension = '.wav'; //Create an array of files with "fileExtension" from folder path. var filesArray = sf.file.directoryGetFiles({ path: folderPath }).paths.filter(x => x.match(fileExtension)).map(x => x.split('/').slice(-1)[0].split('.').slice(0, -1).join('.')); //Log the first file in the fileArray. log(filesArray.sort()[0]);
Andrew Scheps @Andrew_SchepsThanks Kitch, this helps a lot, I can do a recursive search out from the session directory I think.
Kitch Membery @Kitch2020-08-21 16:54:53.850ZAwesome:-)
- In reply toAndrew_Scheps⬆:
Kitch Membery @Kitch2020-08-21 17:29:08.621ZBTW... When you said you are trying to "re-locate" files did you mean "locate again" or "move"?
If you want to move a file you can use somthing like this.
const oldPath = '~/Desktop/Old File Name.wav'; const newPath = '~/Desktop/New File Name.wav'; sf.file.move({ sourcePath: oldPath, destinationPath: newPath, });
Andrew Scheps @Andrew_SchepsNot move, find again, thanks!
- In reply toKitch⬆:
Christian Scheuer @chrscheuer2020-08-22 10:37:07.072ZYes, this is the preferred way. Note there's an option to do recursive search in directoryGetFiles, AFAIK.
Andrew Scheps @Andrew_SchepsThis is great, but even with
onError: 'Continue',if returns a null search if there are any access problems searching the path. For instance if I search the root level of any drive there are hidden directories that make the search stop (/.DocumentRevisions-V100for instance). Is there a way around that?
Christian Scheuer @chrscheuer2020-08-25 09:49:06.554ZI logged a bug report for this :)