Forum > General

FaHidden: Why doesnt get a hidden file

(1/1)

captian jaster:
So.... Im making a program that finds hidden files and shows it in a List.
So a take a couple of files put them in a folder and set them to Hidden. Start the program and it tells me no hidden files.. Why does it work that way.... Or do the files have to have dots at the beginning. I read that thats for unix though...

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TMainForm.StartBtnClick(Sender: TObject);VarInfo:TSearchREC;Counter:Integer;begin  Counter := 0;  IF(DirEdit.Text <>'')Then  begin    StatusLabel.Caption := 'Current Status: '+'Searching...';    IF(FindFirst(DirEdit.Text+'*',FAAnyFile,Info)=0)Then    begin      While NOT(FindNext(Info)<>0)Do      begin        Inc(Counter);        IF(Info.Attr = FaHidden)Then FoundList.Items.Add(Info.Name);      end;    end;  end;  IF(Counter<>0)Then StatusLabel.Caption := 'Current Status: '+'Search Done.'+#13+'Found: '+IntToStr(Counter)+' Hidden Files.'  Else StatusLabel.Caption := 'Current Status: '+'Search Done.'+#13+'No Hidden Files Found!';end;  

eny:
@cj: learn to walk before you try to run. There are so many logic errors in your code that even if I tell you how to find the hidden files, it's never going to do precisely what you want it to do.

My advice: start documenting your code.
Put short comments in your code where you explain to yourself what you want to happen.
That'll help you find the logic errors and help you build working code.

For what it's worth: you need to test Info.Attr on the faHidden bit.
In other words:

--- Code: ---  if (Info.Attr and faHidden) = faHidden then...

--- End code ---
But as I said, there are still a number of logic problems in your code that prevent it from giving the correct results.

Navigation

[0] Message Index

Go to full version