【发布时间】:2013-06-21 04:33:30
【问题描述】:
如果我要尝试更改目录中特定文件类型的权限,例如
chmod ugo-w *.filetype
如何对包含目录中的所有文件也执行此操作?
【问题讨论】:
标签: bash directory subdirectory
如果我要尝试更改目录中特定文件类型的权限,例如
chmod ugo-w *.filetype
如何对包含目录中的所有文件也执行此操作?
【问题讨论】:
标签: bash directory subdirectory
使用 find 和 xargs:
find . -type f -name '*.filetype' | xargs chmod ugo-w
如果不是当前目录,则将.替换为目录名称。
或者,只需使用find:
find . -type f -name '*.filetype' -exec chmod ugo-w '{}' '+'
【讨论】: