如何将 .htaccess 复制到所有 0777 文件夹
how to copy .htaccess to all 0777 folders
以下命令尝试将/.htaccess 复制到所有文件夹权限 0777
find /home/*/www/ -type d -perm 0777 \
| xargs -r -d '\n' cp -rf /.htaccess
正在使用终端 ssh 命令寻找 运行 它
我搜索所有文件夹有 0777 并立即将 htaccess 复制到所有文件夹
find /home/*/www -type d -perm /0777 -print0 | xargs -0 -I{} -r -P4 -n1 cp /.htaccess '{}'
您想结合使用 print0
和 xargs -0
以便它可以处理 IFS 字符。
使用 xargs -n1
以便它一次只尝试复制到一个目录。
我使用 xargs -I{}
来更明确地说明我在做什么。
xargs -P4
将并行化 4 次以提高速度。
与其费心 xargs
,您只需使用 -exec
选项即可 find
:
$ find . -type d -perm 77 -exec cp /.htaccess {} \;
find /home/*/www/ -type d -perm 0777 \
| xargs -I '{}' cp -rf /.htaccess '{}'
以下命令尝试将/.htaccess 复制到所有文件夹权限 0777
find /home/*/www/ -type d -perm 0777 \
| xargs -r -d '\n' cp -rf /.htaccess
正在使用终端 ssh 命令寻找 运行 它
我搜索所有文件夹有 0777 并立即将 htaccess 复制到所有文件夹
find /home/*/www -type d -perm /0777 -print0 | xargs -0 -I{} -r -P4 -n1 cp /.htaccess '{}'
您想结合使用 print0
和 xargs -0
以便它可以处理 IFS 字符。
使用 xargs -n1
以便它一次只尝试复制到一个目录。
我使用 xargs -I{}
来更明确地说明我在做什么。
xargs -P4
将并行化 4 次以提高速度。
与其费心 xargs
,您只需使用 -exec
选项即可 find
:
$ find . -type d -perm 77 -exec cp /.htaccess {} \;
find /home/*/www/ -type d -perm 0777 \
| xargs -I '{}' cp -rf /.htaccess '{}'