Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

file list

2 views
Skip to first unread message

Xiao Ma

unread,
Sep 10, 1999, 3:00:00 AM9/10/99
to
I want to create a list of all the .java files in one directory and all
the subdirectories in one line. I can use "dir /s /b *.java" but it's in
multiple lines.

The goal is to use this list when I compile all the .java files with
javac. I am new to this, so please feel free to give me some suggestion.

Thanks!


Phil Robyn

unread,
Sep 10, 1999, 3:00:00 AM9/10/99
to
Xiao Ma wrote:

How many files do you expect to be returned by this directory command?
Which version of Windows are you running? The length of the command
prompt command line in Win 95 and Win 98 cannot exceed 127 bytes. So
if you align all the filenames from the directory command into a single
line, will your compile command plus all the filenames exceed 127 bytes?


If you are using Win NT then you are not subject to this limitation.


Phil Robyn

unread,
Sep 10, 1999, 3:00:00 AM9/10/99
to
Xiao Ma wrote:

> I want to create a list of all the .java files in one directory and all
> the subdirectories in one line. I can use "dir /s /b *.java" but it's in
> multiple lines.
>
> The goal is to use this list when I compile all the .java files with
> javac. I am new to this, so please feel free to give me some suggestion.
>
> Thanks!

Here is a batch file that will put all the filenames output from a directory

command into one environment variable. Hopefully, it will be run with
a restrictive enough argument so that the output will not overflow the
command line.

========begin file c:\cmd\test\allfiles.cmd========
001. @echo off
002. ::
003. :: align filenames output from directory command onto a single line
004. :: and put the result into an environment variable
005. ::
006. dir /b %1 > %temp%\flz.$$$
007.
008. echo >%temp%\getflz.bat DIM ZFiles AS STRING
009. echo>>%temp%\getflz.bat DIM OneFile AS STRING
010. echo>>%temp%\getflz.bat ZFiles = ""
011. echo>>%temp%\getflz.bat OPEN "%temp%\flz.$$$" FOR INPUT AS #1
012. echo>>%temp%\getflz.bat DO WHILE NOT EOF(1)
013. echo>>%temp%\getflz.bat INPUT #1, OneFile
014. echo>>%temp%\getflz.bat ZFiles = ZFiles + " " + OneFile
015. echo>>%temp%\getflz.bat LOOP
016. echo>>%temp%\getflz.bat CLOSE #1
017. echo>>%temp%\getflz.bat OPEN "%temp%\flzdir.bat" FOR OUTPUT AS #2
018. echo>>%temp%\getflz.bat PRINT #2, "@echo off"
019. echo>>%temp%\getflz.bat PRINT #2, "set flzfiles=" + ZFiles
020. echo>>%temp%\getflz.bat PRINT #2, "goto :end"
021. echo>>%temp%\getflz.bat PRINT #2, ":end"
022. echo>>%temp%\getflz.bat CLOSE #2
023. echo>>%temp%\getflz.bat SYSTEM
024. start /min /wait command /c qbasic /run %temp%\getflz.bat
025. call %temp%\flzdir.bat
026. echo.
027. set flzfiles
028. goto :EOF
029. :EOF
030.
========end file c:\cmd\test\allfiles.cmd========

0 new messages