作为一个相当新手的 Linux 用户,我似乎不知道如何做到这一点。
我正在尝试将一个目录中的所有唯一文件移动到另一个目录中。
例子:
$ ls
vehicle car.txt bicycle.txt airplane.html train.docx (more files)
我想要车内的 car.txt、bike.txt、airplane.html 和 train.docx。
现在我通过单独移动文件来做到这一点:
$ mv car.txt vehicle
$ mv bicycle.txt vehicle
...
我怎样才能在一行中完成此操作?
你可以做
mv car.txt bicycle.txt vehicle/
(请注意,/
上面是不必要的,我添加它只是为了确保vehicle
是一个目录。)
您可以按如下方式进行测试:
cd #Move to home directory
mkdir temp #Make a temporary directory
touch a b c d #Make test (empty) files ('touch' also updates the modification date of an existing file to the current time)
ls #Verify everything is there
mv a b c d temp/ #Move files into temp
ls #See? They are gone.
ls temp/ #Oh, there they are!
rm -rf temp/ #DESTROY (Be very, very careful with this command)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)