Question : Need semi-simple batch script will save me a ton of time and help a lot

ok so I want to write a script in windows that will do the following

traverse all the directories below the current one

when it finds a file that ends with .pom check if there's a file of the same name in the same directory that ends with .jar if there is run this command
mvn deploy:deploy-file -DpomFile=.\ -Dfile=.\ -DrepositoryId=test_repo -Durl=http://156.80.169.167:8081/nexus/content/repositories/test_repo/

if there isn't run this command
mvn deploy:deploy-file -DpomFile=.\ -Dfile=.\ -DrepositoryId=test_repo -Durl=http://156.80.169.167:8081/nexus/content/repositories/test_repo/

continue until you've done this for every directory then end.

This would make my life so so so much easier if somebody could please help me do this.

Answer : Need semi-simple batch script will save me a ton of time and help a lot

Try this.
1:
2:
3:
4:
5:
6:
7:
for /r %%a in (*.pom) do (
    if exist "%%~dpna.jar" (
        mvn deploy:deploy-file -DpomFile="%%a" -Dfile="%%~dpna.jar" -DrepositoryId=test_repo -Durl=http://156.80.169.167:8081/nexus/content/repositories/test_repo/
    ) else (
        mvn deploy:deploy-file -DpomFile="%%a" -Dfile="%%a" -DrepositoryId=test_repo -Durl=http://156.80.169.167:8081/nexus/content/repositories/test_repo/
    )
)
Open in New Window Select All
Random Solutions  
 
programming4us programming4us