第一步:
编辑一下文本,大家可以对脚本按照自己的要求更改:
#!/bin/bash
#chmod all text file to read and write;
find ~ -name "*.doc*" -exec chmod 644 -R {} \;
find ~ -name "*.xls*" -exec chmod 644 -R {} \;
find ~ -name "*.ppt*" -exec chmod 644 -R {} \;
find ~ -name "*.pdf" -exec chmod 644 -R {} \;
find ~ -name "*.txt" -exec chmod 644 -R {} \;
find ~ -name "*.hlp" -exec chmod 644 -R {} \;
find ~ -name "*.wps" -exec chmod 644 -R {} \;
find ~ -name "*.rtf" -exec chmod 644 -R {} \;
find ~ -name "*.htm*" -exec chmod 644 -R {} \;
#chmod all picture to read and wirte;
find ~ -name "*.png" -exec chmod 644 -R {} \;
find ~ -name "*.jpg" -exec chmod 644 -R {} \;
find ~ -name "*.bmp" -exec chmod 644 -R {} \;
find ~ -name "*.jpeg" -exec chmod 644 -R {} \;
find ~ -name "*.gif" -exec chmod 644 -R {} \;
find ~ -name "*.dwg" -exec chmod 644 -R {} \;
find ~ -name "*.pic" -exec chmod 644 -R {} \;
find ~ -name "*.tif" -exec chmod 644 -R {} \;
#chmod all compress to read&write:
find ~ -name "*.rar" -exec chmod 644 -R {} \;
find ~ -name "*.zip" -exec chmod 644 -R {} \;
find ~ -name "*.arj" -exec chmod 644 -R {} \;
find ~ -name "*.gz" -exec chmod 644 -R {} \;
find ~ -name "*.bz*" -exec chmod 644 -R {} \;
#chmod all video to read&write:
find ~ -name "*.avi" -exec chmod 644 -R {} \;
find ~ -name "*.mp3" -exec chmod 644 -R {} \;
find ~ -name "*.wav" -exec chmod 644 -R {} \;
find ~ -name "*.mp4" -exec chmod 644 -R {} \;
find ~ -name "*.swf" -exec chmod 644 -R {} \;
#chmod all source code to R&W;
find ~ -name "*.h" -exec chmod 644 -R {} \;
find ~ -name "*.c" -exec chmod 644 -R {} \;
find ~ -name "*.java" -exec chmod 644 -R {} \;
#到此,脚本结束
第二步:保存脚本文件为chmymod
第三步:修改脚本的权限:chmod 644 chmymod
并将脚本移动到/bin下!
到此,就结束了。大家只要在命令行输入chmymod就可以看到效果了
Linux一次性修改电脑的文件的为读写格式,布布扣,bubuko.com
原文地址:http://7091517.blog.51cto.com/7081517/1436062