Delete all files in a folder from Max

hzd's icon

Hello good people.

Is there a way to delete all files in a specific folder on the computer?
I have found various java stuff that can delete specific files, but I'm looking for a way to delete all the files in this folder with a single command.

The way I have tried doing it with the java stuff filesys is to delete one and one file, but it takes a few seconds, and I haven't got that much time, time is money and all that.

So if anyone has a shot at this, would be great.

cheers

hz37's icon
Max Patch
Copy patch and select New From Clipboard in Max.

[shell] comes to mind. It's super fast if you do a rm /some/folder/* wildcard delete.

hzd's icon

It works. Kinda.

If the folder is in my Max 7 folder, it doesn't work. I can just put the projecet in another folder, but is there a way to get shell to understand the space?
I have tried the "***/***/Max 7/folder/*" and the \ instead of the space and ' instead of "

Any ideas?

Anyways thx for now :)

hz37's icon

The triple asterisks aren't going to work. I'm guessing you're on OSX. Assuming you are referring to the Max 7 folder in your home Documents folder, you can use tilde expansion to quickly get to it:

~/Documents/Max 7

A subfolder in your Max 7 folder will then be

~/Documents/Max 7/subfolder

You can escape spaces using a \ symbol, but you will have to use 2 of those in a Max message to [shell]. So it will be something like:

rm ~/Documents/Max\\ 7/subfolder/*

Instead of tilde expansion you can also refer to the entire path of your folder, in my case something like:

rm /Users/henszimmerman/Documents/Max\\ 7/whatever/*

Good luck!