当你textfile
领域与空格隔开(和你的显示目录和文件名无空格),您可以使用
while read -r dir file1 file2; do
mkdir -p "${dir}"
if [ ! -d "${dir}" ]; then
echo "Something strange with ${dir}, I do not know what to do."
exit 1
fi
if [ -f "${file1}" ]; then
mv "${file1}" "${dir}"
fi
if [ -f "${file2}" ]; then
mv "${file2}" "${dir}"
fi
done < textfile
这将固定NR列的工作。如果你想支持一个未知的NR每行的文件,则必须更改此位:
while read -r dir files; do
mkdir -p "${dir}"
if [ ! -d "${dir}" ]; then
echo "Something strange with ${dir}, I do not know what to do."
exit 1
fi
for file in ${files}; do
if [ -f "${file}" ]; then
mv "${file}" "${dir}"
fi
done
done < textfile
什么你调用“批处理文件”只是包含项目清单/表中的文本文件; [标签:批处理文件]是一个文本文件,使用Windows命令提示命令构成脚本... – aschipfl
请通过单击[编辑](http://stackoverflow.com/posts/35826790/edit)输入您的代码,链接,并显示什么预期和你得到什么错误? – ritesht93