使用管道从 Ubuntu 笔记本电脑中删除所有出现的 Thumbs.db 文件

发布于 2024-09-19 04:04:13 字数 363 浏览 3 评论 0原文

我有一台安装了 Ubuntu 10.04 的笔记本电脑。我将一些文件从一台计算机迁移到这台计算机。但有一些文件,例如 Thumbs.db 文件,我想删除其每次出现的文件。

我尝试使用

locate Thumbs.db | rm

But dis 没有成功(显然不应该)。然后我尝试使用以下内容,但不出所料,它们都没有成功:

locate thumbs.db > rm
locate thumbs.db < rm

正如这里的每个人都可能指出的那样,我在使用管道方面遇到了困难,并且想以此为例来澄清我的概念。我已经阅读了基础知识,但仍然无法直观地应用它。

I have a laptop installed with Ubuntu 10.04. I migrated some of my files from one computer to this computer. But there are some files like Thumbs.db file whose every occurrence I want to get rid of.

I tried using

locate Thumbs.db | rm

But dis didn't worked out (and clearly it should not). Then I tried using following, but quite expectedly none of them worked out :

locate thumbs.db > rm
locate thumbs.db < rm

As everyone here, might have pointed out that I am having a hard time using pipeline and want to just clear my concept using this as an example. I have read the basics but still not able to intitutively able to apply it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

家住魔仙堡 2024-09-26 04:04:13

find 已经具有删除功能,因此不需要管道:

find . -iname thumbs.db -delete

这表示从我当前的工作目录递归删除所有匹配 thumbs.db 的文件,无论大小写如何。

find already has a delete function, so no pipes are necessary:

find . -iname thumbs.db -delete

This says delete all files matching thumbs.db regardless of capitalization, recursively from my current working directory.

飘过的浮云 2024-09-26 04:04:13

您可能需要尝试:

find /mnt/something -iname 'thumbs.db' -exec rm -v {} \;

或者如果您确实想使用管道,您可能需要尝试

find /mnt/something -iname 'thumbs.db' | xargs rm -v

-iname 将搜索“Thumbs.db”和“thumbs.db”。检查 man 以获取更多信息。

/mnt/something 更改为您的路径。

编辑:

我想你也可以尝试一下:

find /mnt/someting -iname 'thumbs.db' | while read junk; do rm -v "$junk"; done

它应该与名称中包含空格的目录一起使用。

You may want try:

find /mnt/something -iname 'thumbs.db' -exec rm -v {} \;

or if you really want use pipe you may want try

find /mnt/something -iname 'thumbs.db' | xargs rm -v

-iname will search for 'Thumbs.db' and 'thumbs.db'. Check man for more info.

change /mnt/something for your path.

Edit:

I think you can also try it:

find /mnt/someting -iname 'thumbs.db' | while read junk; do rm -v "$junk"; done

It should work with dirs what contain space in name etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文