linux - 查找和复制文件

为什么下面没有将文件复制到目标文件夹?

# find /home/shantanu/processed/ -name '*2011*.xml' -exec cp /home/shantanu/tosend {} \;

cp: omitting directory `/home/shantanu/tosend'
cp: omitting directory `/home/shantanu/tosend'
cp: omitting directory `/home/shantanu/tosend'

最佳答案

如果您的意图是将找到的文件复制到 /home/shantanu/tosend 中,则将 cp 的参数顺序颠倒:

find /home/shantanu/processed/ -name '*2011*.xml' -exec cp "{}" /home/shantanu/tosend  \;

请注意:find 命令使用 {} 作为匹配文件的占位符。

https://stackoverflow.com/questions/5241625/

相关文章:

python - 计算列表差异

linux - Apache VirtualHost 403 被禁止

python - BeautifulSoup 获取 href

c - C 到毫秒是否有替代 sleep 功能?

linux - 如何来回反向搜索?

linux - 如何在 Linux 上使用 grep 搜索包含 DOS 行尾 (CRLF) 的文件?

python - 在python中通过分隔符拆分字符串

python - 在调用者线程中捕获线程的异常?

linux - 重命名文件和目录(添加前缀)

linux - 什么进程正在使用我所有的磁盘 IO