简体   繁体   中英

copying jar files into multiple directories

I have written a bash script to copy the files into multiple directories but its not working.

find /usr/local/tomcat/ -not -path /usr/local/tomcat/webapps/test/WEB-INF  -type d  -name WEB-INF | xargs -n 1 echo cp /tmp/myjar.jar

The output of the find command is correct but the file is not getting copied. Where am I going wrong?

您正在xargs命令中调用echo ,只需将其删除即可,它应该可以工作

You have a mistake in your script. The echo command is not needed. Replace it with this instead, just removing the command.

find /usr/local/tomcat/ -not -path /usr/local/tomcat/webapps/test/WEB-INF  -type d  -name WEB-INF | xargs -n 1 cp /tmp/myjar.jar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM