linux 如何移动列出的文件?

标签 linux ubuntu redirect

我尝试将结果重定向到目录中,但它不允许我这样做。我究竟做错了什么 ?

find Documents/ -type f -regextype posix-egrep -regex ".+\.(doc|err|out)$" > Poubelle/

bash: Poubelle/: Is a directory

我想做的是移动 Poubelle 中列出的文件。
预先感谢您

最佳答案

就像 @Barmar 在评论中所说,您需要将 exec 命令与 mvcp 一起使用。

您可以尝试使用以下命令:

将文件移动到目录:

find Documents/ -type f -regextype posix-egrep -regex ".+\.(doc|err|out)$" -exec mv {} Poubelle/ \;

将文件复制到目录:

find Documents/ -type f -regextype posix-egrep -regex ".+\.(doc|err|out)$" -exec cp {} Poubelle/ \;

您还可以使用 rsync。更简单的形式是:

rsync source destination 

有关其他选项,请阅读 here .

关于linux 如何移动列出的文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58180765/

相关文章:

linux - 调整linux内核

mysql - 如何编译以避免共享库错误?

windows - 通过 WSL2 在 Ubuntu 上调整 qcow2 图像的大小? libguestfs-tools virt-resize 无法读取内核

java - UnknownHostException 访问 virtualBox 上的服务

.htaccess ModRewrite 带 2 个参数

linux - 从 HP-UX 迁移到 Red Hat Linux 时,ESQL/C 程序的不兼容性是什么?

python - 有和没有 '/' 的路径之间的区别?

ruby - 如何使用 RVM 让 Upstart 优雅地工作?

.htaccess - 将 HTTP 重定向到 HTTPS Htaccess

php - 如何将 mydomain.io 重定向到 mydomain.com