L. E. Segovia 93b2c29612 Port file trashing to Swift
This avoids hitting AppleScript timeouts in CI.
2019-05-09 20:03:31 +00:00

23 lines
347 B
Swift

#!/usr/bin/swift
import Foundation
if (CommandLine.arguments.count < 2) {
exit(2)
}
let manager: FileManager = FileManager()
for item in CommandLine.arguments[1...] {
do {
let path: URL = URL(fileURLWithPath: item)
try manager.trashItem(at: path, resultingItemURL: nil)
print(path)
}
catch {
print("\0")
}
}
exit(0)