擅长:python、mysql、java
<p>或者,如果您在OSX10.5上,您可以使用脚本桥来通过Finder删除文件。我已经通过rubycoa用Ruby代码<a href="http://osx-trash.rubyforge.org/git?p=osx-trash.git;a=blob;f=bin/trash;h=26911131eacafd659b4d760bda1bd4c99dc2f918;hb=HEAD" rel="noreferrer">here</a>完成了这项工作。其要点是:</p>
<pre><code>url = NSURL.fileURLWithPath(path)
finder = SBApplication.applicationWithBundleIdentifier("com.apple.Finder")
item = finder.items.objectAtLocation(url)
item.delete
</code></pre>
<p>你可以很容易地用PyObjC做类似的事情。在</p>