I copied huge number of (Android SDK) files from a shared directory to my system. Now all files which their MIME types are application/x-shellscript
or application/x-executable
, seems that are not executable. For example when I try to run mksdcard
I get this error:
$ ./mksdcard
bash: ./mksdcard: Permission denied
How I can find only files with those MIME types? And then how I can change those permissions?
Notes:
1- When I tried find <path> -type f -executable
with as root user it shows all files (even .PNG files) and when I tried that with standard user, it shows nothing. I do not know how to filter files with attention to their MIME type.
2- Share directory (source) currently is not accessible.
The
find
command doesn't test mimetype itself, but you can use it to execute themimetype
command andgrep
the result.For example
To perform some operation on the matching files (such as a
chmod
orchown
), replace theprintf
command with that e.g.I highly recommend checking the current ownership and permissions first e.g. with
ls
Hint:
Then press / and enter
attr
(part of 'attributes') and press ENTER.Now, read the portions of the text that got marked.
Hitting n or p will make the display jump to 'n'ext or 'p'revious instance.
Attempt to explain:
Assuming that you still have the original files available you may restore the file attributes of your copied files by use of this argument to 'cp' (copy), together with your originial arguments.
If I'm not entirely mistaken you will get the settings for all the mentioned files corrected by this.