一份通配符批量副本适合我:
sudo cp /home/jenkins/dist/*.war /opt/tomcat/webapps/
但另一个类似的则不然:
sudo cp /opt/tomcat/webapps/*.war /home/jenkins/archive
cp: cannot stat '/opt/tomcat/webapps/*.war': No such file or directory
但实际上这两个文件夹都有这样的文件:
sudo ls -l /opt/tomcat/webapps/
total 330536
drwxr-x--- 5 tomcat paysoft 4096 Sep 26 02:12 ROOT
-r-x------ 1 tomcat tomcat 127981631 Sep 26 02:10 ROOT.war
drwxr-x--- 4 root root 4096 Feb 26 2023 site-api
-r-x------ 1 tomcat tomcat 106277537 Sep 26 02:11 site-api.war
drwxr-x--- 4 tomcat paysoft 4096 Sep 26 02:11 web-api
-r-x------ 1 tomcat tomcat 104181448 Sep 26 02:11 web-api.war
和
sudo ls -l /home/jenkins/dist/
total 569312
-rw-r--r-- 1 jenkins jenkins 112948432 Aug 1 2022 money-transfer-web.jar
-rw-r--r-- 1 jenkins jenkins 127981631 Sep 26 02:03 ROOT.war
-rw-r--r-- 1 jenkins jenkins 106277537 Sep 26 02:03 site-api.war
-rw-r--r-- 1 jenkins jenkins 131561362 Sep 26 02:03 terminal-server.jar
-rw-r--r-- 1 jenkins jenkins 104181448 Sep 26 02:03 web-api.war
是什么原因?
PS 目录本身是:
sudo ls -l /home/jenkins/
total 8
drwxr-xr-x 2 root root 4096 Jul 11 15:20 archive
drwxr-xr-x 2 jenkins jenkins 4096 Jun 30 2022 dist