222文件内容:

/home/zhangsuosheng/Desktop/9-30/9_30/1bak/1538291162.png
/home/zhangsuosheng/Desktop/9-30/9_30/1bak/1538291212.png
/home/zhangsuosheng/Desktop/9-30/9_30/1bak/1538291241.png
/home/zhangsuosheng/Desktop/9-30/9_30/1bak/1538291267.png
/home/zhangsuosheng/Desktop/9-30/9_30/1bak/1538291276.png
/home/zhangsuosheng/Desktop/9-30/9_30/1bak/1538291284.png
/home/zhangsuosheng/Desktop/9-30/9_30/1bak/1538291298.png
/home/zhangsuosheng/Desktop/9-30/9_30/1bak/1538291309.png
/home/zhangsuosheng/Desktop/9-30/9_30/1bak/1538291341.png
/home/zhangsuosheng/Desktop/9-30/9_30/1bak/1538291355.png
/home/zhangsuosheng/Desktop/9-30/9_30/1bak/1538291367.png
/home/zhangsuosheng/Desktop/9-30/9_30/1bak/1538291372.png
/home/zhangsuosheng/Desktop/9-30/9_30/1bak/1538291381.png

想把这些文件复制到/home/zhangsuosheng/Desktop/test/文件夹下。使用shell命令进行批量操作

cat  | while read line;do cp $line /home/zhangsuosheng/Desktop/test/; done;

最关键的。是while read line,代表对管道中数据逐条循环。

参考:http://www.voidcn.com/article/p-dlnkthqy-yz.html

05-28 13:30