Kroko Just another WordPress weblog

November 6, 2015

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

Filed under: Linux — admin @ 11:09 am

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

Powered by WordPress