为什么下面没有将文件复制到目标文件夹?
# 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/