Open youngjuning opened 5 years ago
在bash下执行以下命令,这是递归
find ./ -name "*.c" | awk -F "." '{print $2}' | xargs -i -t mv ./{}.c ./{}.h
新建 *.sh 文件,并写入以下代码,然后复制到你要替换的文件目录下 注意,这个方案不是递归
#!/bin/sh oldsuffix="js" newsuffix="jsx" dir=$(eval pwd) for file in $(ls $dir | grep .${oldsuffix}) do name=$(ls ${file} | cut -d. -f1) mv $file ${name}.${newsuffix} done echo "change js to jsx successd!"
Linux 命令【递归】
shell 脚本【非递归】