Home » Questions » Computers [ Ask a new question ]

command-line / batch file to list all the jar files?

command-line / batch file to list all the jar files?

I want to list all the jar files in subdirectories of a specified path, on a Windows computer, along with the file size & times.

Asked by: Guest | Views: 234
Total answers/comments: 2
Guest [Entry]

"you could do this:

for /r %i in (*.jar) do echo %~ti %~zi %i

which will iterate over all dirs (including the current one) and echos out the *.jar names. It will also echo out the echo command, so you may want to pipe the output to a file:

for /r %i in (*.jar) do echo %~ti %~zi %i >> myJars.txt

or put it in a bat:

@echo off
for /r %%i in (*.jar) do echo %%~ti %%~zi %%i

note the double %'s in the .bat version."
Guest [Entry]

The closest I was able to get to what you needed was dir /p /s *.jarThis gives out the files' directory locations, their size, and their date/timestamp.