I mean the right way must able to "Put Back" in Finder and isn't playing sound
Here are the methods I tried so far:
NSString * name = @"test.zip";
NSArray * files = [NSArray arrayWithObject: name];
NSWorkspace * ws = [NSWorkspace sharedWorkspace];
[ws performFileOperation: NSWorkspaceRecycleOperation
source: @"/Users/"
destination: @""
files: files
tag: 0];
Downturn : can't "Put Back" in Finder
OSStatus status = FSPathMoveObjectToTrashSync(
"/Users/test.zip",
NULL,
kFSFileOperationDefaultOptions
);
Downturn : can't "Put Back" in Finder
tell application "Finder"
set deletedfile to alias "Snow Leopard:Users:test.zip"
delete deletedfile
end tell
Downturn : playing sound so it's annoying if I execute it repeatedly
I think if you want "put back" then applescript is the way to go. I was able to do it without any sound by muting the volume, moving the file, then unmuting the volume. Note I needed a delay to get it to work.
set f to (path to desktop folder as text) & "myFile.txt"
set volume with output muted
tell application "Finder" to move file f to trash
delay 1
set volume without output muted
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With