Delete a file with Node for Max

benj3737's icon

Hello!
I'm solid with max but I'm pretty clueless about node.
From my research it seems like we can delete files with node.
Does anyone have an example or suggestion on where to look?
Thank you
Ben

benj3737's icon

I'm doing more research and I found the filesystem page of the Node for Max overview.
However, when I send a 'rm' command to node, I get an error saying

'node.script: Node script not ready can't handle message rm'

Any tips?

Source Audio's icon

If you can't manage to run node script ??? , try to use shell object.
it needs absolute path to file to delete, slash based.
If this is to delete sfrecord files, you could use savedialog to make file
in first place, and use same path to delete it later.

Option 2 is to record into buffer, if recording is not that long,
then crop and write buffer if you want to keep recording.

benj3737's icon

I'm still trying to hunt this down!

Here's something I adapted from the Node4Max overview.

As far as I can tell, I should be able to drop a file in the patcher, and have Node delete it, but I get an error.

Can anyone see where I'm messing up?

Thank you!
Ben

Max Patch
Copy patch and select New From Clipboard in Max.

Source Audio's icon

check path.
all this shell based objects need slash based path

This won't work:
"Mac Hd:/Users/user/Desktop/File to delete.rtf"
this does:
"/Users/user/Desktop/File to delete.rtf"

Read conformpath help, and set it according to
OS used.
on Mac :

By the way - using node forces one to use CEF framework,
which then makes Standalone apps much bigger size.
Using shell object instead is much easier.