When I plug-in an USB stick (FAT) into my Mac or Ubuntu machine, all files have the executable bits set. After having copied the directory structure to my hard disk how do I remove the executable bits recursively just from the files and keep those on the directories?
|
A single command variant (starting in the current directory):
Explanation:
In this case the capital Note:
I tested the command with GNU |
||||
|
If you cd into the correct path first:
The find finds all files of type 'f' (which means regular file) in the path . and then calls chmod -x on each file. The {} gets substituted for the file name and the \; terminates the chmod command. |
|||||
|
|
The
If there might be any fancy extra stuff such as sockets in your filesystem, you may want to surround the last chmod with a try/catch. |
|||
|
|