dedecms默认目录重命名

删除文件字符串之间的内容

1
2
3
find ./ -name "*.html" -exec grep "95baidu" {} \; -exec sed -ri '/<div\s+id="95baidu">/{p;:a;/<\/div>/!{N;ba};d};' {} \;
# 注意
# 该方式只能做到 `<div id="95baidu">\n****\n</div>` 替换为 `<div id="95baidu">`, 开始位置行`<div id="95baidu">`未能删除

dedecms 默认目录改名

dede目录

1
2
# dede => ocadmin
mv dede ocadmin

include目录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 查看含有include字符串的文件
find ./ -name "*.php" -o -name "*.html" -o -name "*.htm" -exec grep "include" {} \;

# include => occlude
find ./ -name "*.php" -exec grep "/include/common/" {} \; -exec sed -ri 's/\/include\/common/\/occlude\/common/' {} \;
find ./ -name "*.php" -exec grep "/include/dialog/" {} \; -exec sed -ri 's/\/include\/dialog/\/occlude\/dialog/' {} \;
find ./ -name "*.php" -exec grep "\.\./include/" {} \; -exec sed -ri 's/\.\.\/include\//\.\.\/occlude\//' {} \;
find ./ -name "*.php" -exec grep "/include/FCKeditor/" {} \; -exec sed -ri 's/\/include\/FCKeditor/\/occlude\/FCKeditor/' {} \;
find ./ -name "*.php" -exec grep "/include/ckeditor/" {} \; -exec sed -ri 's/\/include\/ckeditor/\/occlude\/ckeditor/' {} \;
find ./ -name "*.php" -exec grep "/include/htmledit/" {} \; -exec sed -ri 's/\/include\/htmledit/\/occlude\/htmledit/' {} \;
sed -ri 's/\\\/include\$/\\\/occlude\$/' include/common.inc.php
find ./ -name "*.htm" -exec grep "\.\./include/" {} \; -exec sed -ri 's/\.\.\/include\//\.\.\/occlude\//' {} \;
find ./ -name "*.htm" -exec grep "/include/dialog/" {} \; -exec sed -ri 's/\/include\/dialog/\/occlude\/dialog/' {} \;
find ./ -name "*.htm" -exec grep "}/include/" {} \; -exec sed -ri 's/\}\/include\//\}\/occlude\//' {} \;
mv include occlude

删除文件bom头

1
find ./ -name "*.php" -o -name "*.html" -o -name "*.htm" -exec grep -r -I -l $'^\xEF\xBB\xBF' {} \; -exec sed -ri 's/^\xEF\xBB\xBF//g' {} \;