Deleting files from your hard drive?


    Jul 08 2010 | 8:03 am
    Is it possible to delete files from your hard drive with Max?
    I am saving a couple of audio files and a text file in my patch and I would like to delete those files when the patch gets closed. I'm on OSX.
    I know a little bit Java so maybe I could find a solution there (creating a mxj object for te problem)?
    Any help would be nice.

    • Jul 08 2010 | 8:05 am
    • Jul 08 2010 | 8:13 am
      Thanks but if it is possible I would like to solve it without externals. Unless it would be something I program myself in Java.
      Also I'm using Max 5.
    • Jul 08 2010 | 8:54 am
      Here is a small JAva class:
      p
    • Jul 08 2010 | 3:11 pm
      Thanks alot!
      Can I conclude from this that with the native Max objects there is no solution for the problem?
    • Jul 09 2010 | 8:13 am
      I'm afraid there isn't. But that's why Java is included in Max.
      The shell option is also valid, but it's not portable on MSWin.
      p
    • Jul 09 2010 | 8:22 am
      And with the "shell option" you mean the external posted above?
    • Jul 09 2010 | 9:09 am
      I mean EMV's solution. shell doesn't exist on MSWin, although there is some kind of equivalent object (DOSHack). But if you need portability, then you 'll have to check in what environment you are, and then instantiate the right object thru scripting, etc. It's a real PITA.
      p
    • Jul 09 2010 | 10:09 am
      Thanks for the explanation.
      Do you maybe know a way to get the files you delete into OSX's Trash instead of hard deleting them from the Hard Drive?
    • Jul 09 2010 | 10:39 am
      On OSX, you should move the file to ~/.Trash
      Here again, we are loosing portability...
      It can be done with my Java class but will need some tweaking:
    • Jul 09 2010 | 11:18 am
      Thanks for your quick reply. I don't care much about windows so no problems there.
    • Jul 12 2010 | 5:22 am
      Out of curiosity, can this be done with javascript too?
    • Jul 12 2010 | 8:24 am
      I don't think so!