Find file or directory name in an ANT script.

  1. script for finding file name(fieleNamePrefix) inside the dir
    <fileset dir=”${dirPath}” id= “jarId” >
    <include name= “fieleNamePrefix*.jar” />
    </fileset >
    <property name= “jarName” refid= “jarId” />
  2. script for finding folder name(folderNamePrefix) inside the dir
    <dirset dir=”${dirPath}” id=”dirId”>
    <include name=”folderNamePrefix*”/>
    <property name= “dirName” refid= “dirId” />

basename function in Windows batch script

for /F "delims=" %i in ("c:\foo\bar space.txt") do @echo %~ni
for /F "delims=" %i in ("c:\foo\bar space.txt") do @set "basename=%~ni"
echo %basename%
set "path=c:\foo\bar space.txt"
for /F "delims=" %%i in (%path%) do @echo "%%~ni"
set "path=c:\foo\bar space.txt"
for /F "delims=" %%i in (%path%) do @set "basename=%%~ni"
echo %basename%

Check Java default heap size

  • $ java -XX:+PrintFlagsFinal -version | grep HeapSize
    The output should be look like below:
        uintx ErgoHeapSizeLimit                         = 0                                   {product}
        uintx HeapSizePerGCThread                       = 87241520                            {product}
        uintx InitialHeapSize                          := 268435456                           {product}
        uintx LargePageHeapSizeThreshold                = 134217728                           {product}
        uintx MaxHeapSize                              := 4294967296                          {product}
    java version "1.8.0_171"
    Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
    Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

see also