0

I'm using Amazon Linux with bash shell. I'm trying to touch every file in a certain directory, but this command is failing:

[myuser@mymachine scripts]$ find /usr/java/jboss/standalone/deployments/myapp.war -type f -exec touch '{}' ;
find: missing argument to `-exec'

How do I correct the above?

  • Is myapp.war a folder? – Kusalananda Jun 7 '17 at 14:53
  • Yes myapp.war is a folder – Dave Jun 7 '17 at 14:59
2
-exec touch {} \;

or better yet the modern xargs-style

-exec touch {} +

as ; otherwise is used by the shell for conflicting purposes.

| improve this answer | |
  • 1
    Awesome. Posterity will note that the complete command is "find /usr/java/jboss/standalone/deployments/myapp.war -type f -exec touch {} +" – Dave Jun 7 '17 at 14:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.