从 Windows NTFS 分区上复制过来的文件,会都带有可执行权限。

这个小脚本可以批量 chmod -x 指定路径的文件。

1
2
3
4
5
#!/usr/bin/bash

echo -n "path to files: "
read p2fs
find $p2fs -type f -exec chmod -x {} +

不会对目录本身生效(Linux 需要目录可执行才能读取内容)。