Renaming a file (or mp3) - the system file name
Hi there...
Is there any way to rename a file on the system? Been looking around for a while now...
I'm making a mp3 metadata modifier as part of a larger project, but would also like to be able to rename the file itself from within Max.
Here is a small section of my patch for dropping the files into a displaying the file name. The idea is that you could just retype the filename in the 'textedit' box and change the name on the system....
Thanks for any help....!!
Yeah, I tried that object. It's great, but not exactly what I had in mind as it opens up a system dialog box and requires browsing to the file to re-save it.
I just want to type in the textbox and hit enter...
Thanks though!
Sorry, I can't open your patch (no Max5 before monday!) so maybe I missed something, but you don't need to use a dialog box with mxj sysfile. Just send it the message mv oldfilepath newfilepath. The filepathes have to be formatted the Max' way (look at the output of [p mv] in the help file).
patrick's object is great. there is also a c-object that does this in the jamoma distribution.
Thanks guys - I'll take a look a little later today.....
Hi again guys!
So I had a look again at the MXJ SYSFILE you mention and figured out a method to right the new filenames to it from the textbox.
Trouble is I need to combine the new filename that would be typed to the textedit with the folder/directory path of the file drop originally into the dropfile.
Hence I now need a way to seperate the folder path information from the filename, so that I can just re-combine the folder path with the new name....!
I know strippath strips the folder path, but how can I strip the filename?? - leaving just the path??
Well, no responses, so I figured it out eventually (splitting the folder and file name to show both separately) - don't need 'strippath' now!
Don't need any third party object here either...
Here's my solution.... hope someone find it useful!
Here is another solution, with the very usefull regexp:
Hey Patrick
Thanks for that - I'm not really down with that regexp yet... will have to learn it, as I know it could speed things up - thanks for that.
In the mean time, I was wondering if you could tell me why the MXJ SYSFILE object in this patch doesn't work (below).
As far as I can see the [p mv] object is kicking out the right messages, but it doesn't change the file names. I get a -1 or 0 out of it, indicating it's unsuccessful!
BTW - I'm on PC, Windows 7
I simplified your patch a little (but didn't test exhaustively). But even the patch you sent did work for me (not as you expect, but without an error code from sysfile). Unfortunately, I cannot test under Windows. Tell me if this version works better:
When working with filenames (and symbols in general), always test with symbols with and without spaces.
Great! Thanks Patrick.
Your version seems to work for me on Windows. I see what you have done, but I think the only part which I don't fully understand, is the '@trigger 1' argument in the [combine] object.
I read the help file, but it didn't really make things clear for me. Either way, I'll use this version in my main patcher.
I did add one small feature - so that every time the file is renamed, the new name is sent through the patch again. This way you don't have to keep putting the file back in via [dropfile] and can rename as much as you want!
Thanks again.
Here is the patch with my addition.
About combine: it will be triggered (i.e. it will output its combined symbol) only when it receives something in its second inlet (i.e. the user modified filename - inputs are numbered from 0). This is not the normal behavior of Max objects, which are normally triggered with their leftmost inlet.