Subject: | Re: program guilty in amarican or frensh region?
| Date: | 10 Oct 2017 07:31:26 -0400
| From: | "Thies Grimm" <thies.grimm@t-online.de>
| Newsgroups: | pnews.paradox-programming
|
Hallo Günter,
as far as I know is the result of dir is language and Windows Version dependent.
So I won't use it the way you do.
You could get all directories using (for example)
dir c:\service /A:D /s /B
A:D only Dirctories
S include all SubDirs
B using simple Format
So this is language and Windows Version independent
To get the size of a Directory use something like:
move to the Directory you are interested in
c:
cd c:\service
read the size using powershell from the commandline
powershell -noprofile -command "ls -r|measure -s Length" >dirInfo.txt
and the read the dirInfo.txt
Best Regards from Hamburg
Thies
=?UTF-8?Q?G=c3=bcnter?= <info@NoSpam-mk-news.com> wrote:
>wrote a litte method to get free size and used size of a dir
>its guilty for german windows,
>do it function in other regions?
>
>Type
> arrays=array[]string
> arrayli=array[]longint
>endType
>
>method GetDirInfo_arli(Dirs string)arrayli
>var
> ali longint
> bli longint
> arli arrayli
> ars arrays
> brs arrays
> Dateinames string
> fs filesystem
> s string
> s1 string
> ts textstream
> Zahls string
>endvar
> arli.setsize(2)
> Dateinames=Dirs+"\\dirInfo.txt"
> fs.delete(Dateinames)
> ts.open(Dirs+"\\Dirinfo.bat","NW")
> ts.writeline("dir /s \""+Dirs+"\" > \""+Dateinames+"\"")
> ts.close()
> execute(Dirs+"\\Dirinfo.bat")
> for ali from 1 to 1000
> if fs.findfirst(Dateinames) then
> quitloop
> endif
> sleep(100)
> endfor
> ts.open(Dateinames,"R")
> ts.readline(ars)
> ts.close()
> try
> if ars.size()>0 then
> for ali from ars.size() to 1 step -1
> if ars[ali].size()>0 then
> s=ars[ali]
> s=s.ltrim()
> s.breakapart(brs);brs.view()
> Zahls=""
> if brs.size()=5 then ;frei das letzte Wort o.s.ä.
> s=brs[3]
> for bli from 1 to s.size()
> s1=s.substr(bli)
> if s1.advmatch("[0-9]") then
> Zahls=Zahls+s1
> endif
> endfor
> arli[1]=longint(Zahls);Zahls.view(arli[1])
> else
> s=brs[3]
> for bli from 1 to s.size()
> s1=s.substr(bli)
> if s1.advmatch("[0-9]") then
> Zahls=Zahls+s1
> endif
> endfor
> arli[2]=longint(Zahls)
> quitloop
> endif
> endif
> endfor
> endif
> onfail
> arli[1]=0
> arli[2]=0
> endtry
> return(arli)
>endMethod
>
>Günter (Berlin)
|