Link to home
Start Free TrialLog in
Avatar of acorp
acorp

asked on

command line program

i need it urgent
it's for my exam
i need command line program that reads the directory (dir name given in the command line) and shows the size of the current dir
then after second user input it sorts the dir with size bigger than the size given
Avatar of kretzschmar
kretzschmar
Flag of Germany image

hi acorp,
a commandline-program like a dosbox?
meikl



? a bat can do it ? be more specific !

@echo off
if %1 =="" goto Usage
dir %1
pause
dir %1 /os
goto exit
:usage
echo Give a dir
:exit

meikl
ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
oops, forgotten, the whole whole size
replace with this

var
  TheDir : String;
  CollectedSize : Integer;

procedure GetFiles(PathFileName : string; Size : Integer);
var
  srec : TSearchRec;
  Path, FileName : String;
begin
 Form1.Memo1.Lines.Clear;
 CollectedSize := 0;
 Path := ExtractFilePath(PathFileName);
 FileName := ExtractFileName(PathFileName);
 if findfirst(PathFileName,faanyfile,srec) = 0 then
   repeat
     If Not(srec.attr and fadirectory > 0) then
       if srec.size > size then
       begin
         Form1.Memo1.Lines.add(Srec.Name + '//'+ inttostr(Srec.size));
         CollectedSize := CollectedSize + Srec.Size;
       end;
   Until findnext(srec) <> 0;
 FindClose(SRec);
 Form1.Edit1.text := InttoStr(CollectedSize);
end;

meikl
Avatar of rwilson032697
rwilson032697

Hi Meikl,

I think you're missing a very important part of the question:

"Its for my exam"

The EE guidelines clearly state that EE forums may not be used for solutions to homework and related problems. Both the asker and the answerer of such questions risk being thrown off EE.

Cheers,

Raymond.

oops, overlooked this, thanks raymond.
acorp, let delete this q.