I m getting error in follwing command
cd /opt/lampp/htdocs/EspoCRM-2.5.2 && find data -type d -exec chmod 775 {}
error:
find: missing argument to `-exec'
You need to mark your exec as finished with \;
Your command would look like:
cd /opt/lampp/htdocs/EspoCRM-2.5.2 && find data -type d -exec chmod 775 {} \;
BTW: You don't need to cd into a dir. find can take a complete path where to search. So
find /opt/lampp/htdocs/EspoCRM-2.5.2/data/ -type d -exec chmod 775 {} \;
should also work as find call.
As others have said, find's -exec needs to be terminated. However I would actually suggest using + instead of \;. This only works for some commands but using + will build and run a much more efficient command.
For example, if you have three files (a, b and c) in a directory and you run find -exec echo {} \; it will execute:
echo a
echo b
echo c
However, if you use find -exec echo {} + it will dynamically select as many arguments as the environment supports (there is a limit) and, like xargs chains them together... So what is actually run is:
echo a b c
As I said before this will only work if your command supports multiple files at a time. chmod is one of this. You can tell by looking at the man chmod page:
SYNOPSIS
chmod [OPTION]... MODE[,MODE]... FILE...
chmod [OPTION]... OCTAL-MODE FILE...
chmod [OPTION]... --reference=RFILE FILE...
The ellipsis on FILE... means it can take more than one file.
So yeah, chaining them all together means we run much fewer instances of chmod which is good because there's quite a large overhead (on small operations like this) for forking out a new command.
In short, using + is faster.
You need to end your command with \;
Try this:
cd /opt/lampp/htdocs/EspoCRM-2.5.2 && find data -type d -exec chmod 775 {} \;