I'm trying to run a command line tool and taking the result. I checked it in terminal:
/usr/bin/exiftool -filename -directory -createdate -model "/Users/dirk/Desktop\" -t -S -q -r -f >"RenamerOutfile0.txt"
This runs fine and delivers result in file. Using SWIFT I tried this:
let task = NSTask()
task.launchPath = "/usr/bin/exiftool"
task.arguments = ["-filename -directory -createdate -model \"/Users/dirk/Desktop\" -t -S -q -r -f"]
let pipe = NSPipe()
task.standardOutput = pipe
task.launch()
let data = pipe.fileHandleForReading.readDataToEndOfFile()
Unfortunatly nothing happens. data is assigned 0 byte - no result. If I insert the redirection to file no file is created. Any idea what's the difference in calling the tool from terminal than with this task?
I found a workaround:
This works fine. Maybe because I added the path /var/tmp for output file? Doesn't matter! :-)