我的桌面上有从 Picture_1.png 到 Picture_77.png 的图片。
我现在在终端中一个名为 Pictures 的文件夹中。我想将图片移动到我现在所在的文件夹中。
我尝试了以下代码不成功
mv Picture_[1-77].png
我不确定应该为目标文件夹添加什么,因为我在目标文件夹中。
你怎么能解决这个问题?
mv /path/to/pictures/Picture_* ./
./
表示“当前目录”
从字面上看,您可以像这样解决它:
mv ~/Desktop/Picture_{1..77}.png ./
If you want to move all the pictures beyond 77 and other numbers too, Daniel L solution will do it too. His one is simplier and the best ad hoc solution if you know those are the only files with a Picture_
prefix.
即使您位于目标文件夹,也需要指定目标文件夹。例如,如果我的文件在 Foo 文件夹中,我想将它们移动到 Bar 文件夹中。假设我在 Foo 文件夹中,这是目录的组织方式:
/ (根)
|--Foo/
|--Bar/
然后,我会做(在 Foo 文件夹内):
mv Picture_* ../Bar/