shell筛选文件夹下的部分文件到新目录
shell读取abc.txt文件,每行是一个文件夹名,文件夹名字长32个字符,
因为abc.txt读取到每行都有\r和其他字符结尾,故用line=${line:0:32}只取到文件名。
该脚本实现从html目录挑选出名称在abc.txt里文件夹到out目录
#!/bin/bash while read line do echo "line:"$line line=${line:0:32} cp -rf "html/"${line} out/ done <abc.txt