我尝试通过使用for循环从命令行复制视频文件x次,我尝试过这样做,但它不起作用:
for i in {1..100}; do cp test.ogg echo "test$1.ogg"; done发布于 2016-06-21 06:45:15
for i in {1..100}; do cp test.ogg "test_$i.ogg" ; done发布于 2016-06-21 06:59:37
短而精确
< test.ogg tee test{1..100}.ogg或者做得更好
tee test{1..100}.ogg < test.ogg >/dev/null有关更多帮助,请参见tee命令使用。
正如@Gille所建议的那样,使用tee存在不保存任何文件元数据的缺陷。为了克服这个问题,您可能必须在此之后按照命令运行:
cp --attributes-only --preserve Source Target发布于 2018-01-15 14:32:02
复制时没有调用变量i。
使用下面的脚本。经过测试,效果很好
for i in {1..10}; do cp -rvfp test.ogg test$i.ogg ;donehttps://unix.stackexchange.com/questions/291065
复制相似问题