I want to drop a CSV file in a folder, have it processed by an R script (which I have been using for years and is fine) which outputs an output file, and then the original input file is moved.
I have it working but I don't think it is the most efficient, as I am getting Hazel to rename the file before the script is called, and then the filename is hard coded. I can't get the filename to be passed from Hazel to R, and also can't see much info in the logs. I've read the user guide https://www.noodlesoft.com/manual/hazel/attributes-actions/using-shell-scripts/ but think I am missing something basic as I am not a terminal expert.
My shell is
- Code: Select all
/usr/local/bin/Rscript
The first line of the code that works - hard coded
- Code: Select all
data <- read.csv("~/Dropbox/testing\ related/input.csv", fileEncoding="latin1")
The code that doesn't work - trying to pass the path and file name
- Code: Select all
data <- read.csv("$1", fileEncoding="latin1")
Any advice appreciated.