将垃圾项目恢复到原始位置 - Linux

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4047011/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-04 23:50:21  来源:igfitidea点击:

Restore trash item to original location - Linux

linux

提问by

I'm wondering if it is possible to restore a file that is in the trash (~/.Trash) to its original location.

我想知道是否可以将垃圾箱 ( ~/.Trash)中的文件恢复到其原始位置。

I understand there is a restore command but I don't understand its arguments or how to correctly use it.

我知道有一个恢复命令,但我不明白它的参数或如何正确使用它。

Is this a fairly simple thing to do?

这是一件相当简单的事情吗?

Cheers

干杯

回答by Cascabel

.Trashis just a (hidden) directory. All you need to do is move it out:

.Trash只是一个(隐藏)目录。您需要做的就是将其移出:

mv ~/.Trash/foo ~/

or using the file browser of your desktop environment, open the trash and drag it out.

或使用桌面环境的文件浏览器,打开垃圾箱并将其拖出。

回答by TehWan

As far as I know, in the trash folder (~/.local/share/Trash/), there is a folder with the files (files/) and a folder with the file information (info/). Each file has an associated .trashinfofile in which the original path and time of deletion are stored. You can use that to restore the file to its original location.

据我所知,在回收站文件夹 ( ~/.local/share/Trash/) 中,有一个包含文件的文件夹 ( files/) 和一个包含文件信息的文件夹 ( info/)。每个文件都有一个关联.trashinfo文件,其中存储了原始路径和删除时间。您可以使用它来将文件恢复到其原始位置。

回答by ephemient

If your desktop environment followed the XDG Trash Can Specificationwhen trashing the file, then restore-trashfrom trash-cliwould do the trick.

如果您的桌面环境在删除文件时遵循XDG Trash Can 规范,那么restore-trashtrash-cli就可以了。

What desktop do you use?

你用什么桌面?

回答by user1531722

If you want to restore Trash Mac to original location - Linux then one would have to use third party Trash recovery tool. http://www.howtorestoretrashonmac.com

如果您想将垃圾桶 Mac 恢复到原始位置 - Linux,则必须使用第三方垃圾桶恢复工具。 http://www.howtorestoretrashonmac.com