I made a backup to an NTFS drive, and well, this backup really proved necessary. However, the NTFS drive messed up permissions. I'd like to restore them to normal w/o manually fixing each and every file.
One problem is that suddenly all my text files gained execute permissions, which is wrong ofc. So I tried:
sudo chmod -R a-x folder\ with\ restored\ backup/
But it is wrong as it removes the x
permission from directories as well which makes them unreadable.
What is the correct command in this case?
Best Answer
If you are fine with setting the execute permissions for everyone on all folders:
The
-x
removes execute permissions for allThe
+X
will add execute permissions for all, but only for directories.See below for a solution that uses
find
to really not touch folders as requested.