How to remove executable bit recursively from files (not directories)

No Comments

When I plug-in an USB stick (FAT) into my Centos Linux machine, all files have the executable bits set. After having copied the directory structure to my hard disk I remove the executable bits recursively just from the files and keep those on the directories with following command:

chmod -R -x+X *

Explanation:

  • -R – operate recursively
  • -x – remove executable flags for all users
  • +X – set executable flags for all users if it is a directory

Leave a Reply