I'm automating a number of things that person was doing manually who has left the organization.
That person was running the following daily to a log file to show what files have been created by a piece of software.
Code:
find /path/to/data -mtime -1 -type f -exec stat -c "%n %y" {} \; sort >> /home/user/log.txt &
When I run the whole find, -exec and sort command, from the CLI first, I' getting the error message:
Code:
find: paths must precede expressions: sort
When I back it off, the find and -exec will run correctly, there is something with the sort that is causing the issue
Code:
find /path/to/data -mtime -1 -type f
find /path/to/data -mtime -1 -type f -exec stat -c "%n %y" {} \;
Took the error message and a couple of hits in the search engine (Stack Exchange) shows that an argument needs to be quoted with single quotes, except I'm not sure what needs to be quoted. I tried to single quote the sort part, however that didn't work. Not sure what the issue is.
thanks