将文件和文件夹无意移动到不存在的位置 [英] Moving Files and Folders Accidentally to Non-existent Places

查看:582
本文介绍了将文件和文件夹无意移动到不存在的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


$ b

  mv文件夹$ something_that_does_not_exist 
mv文件* $ something_that_does_not_exist

然后,我意识到我的文件已经不存在了。即使在文件夹$ something_that_does_not_exist中也看不到它们。我的文件和文件夹哪里去了?我怎样才能让他们回来?为了防止这个问题,我有一个习惯总是附加一个/到当使用 cp mv

  $ touch foo 
$ mv foo bar /
mv:无法将`foo'移动到`bar / foo':没有这样的文件或目录

如果没有结尾的斜杠, mv 会执行文件重命名操作。您可能会发现您的文件已更改名称。


I often do the command such as:

mv folder $something_that_does_not_exist
mv files* $something_that_does_not_exist

Then, I realise that my files are gone. I cannot see them even in the folder "$something_that_does_not_exist". Where have my files and folders gone? How can I get them back?

解决方案

In order to prevent this problem, I have a habit of always appending a / to the end of directory names when using cp or mv:

$ touch foo
$ mv foo bar/
mv: cannot move `foo' to `bar/foo': No such file or directory

Without the trailing slash, mv does a file rename operation. You may find that your file(s) have changed name.

这篇关于将文件和文件夹无意移动到不存在的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆