* * *

Recent Posts

Pages: [1] 2 3 ... 10
1
General / Re: FindAllFiles not working on Ubuntu Folders
« Last post by wp on Today at 06:35:00 pm »
Your file mask is '*.*', and this means, in my eyes, that there must be a period in the filename. Try a simple '*'.
2
General / Re: FindAllFiles not working on Ubuntu Folders
« Last post by KarenT on Today at 06:24:19 pm »
The Help says "faSysFile" is for Linux but I can't get it to work any better with the Laz-FindAllFiles

  FindAllFiles(slFiles,'/home/karen/.config/','*.*',True,faAnyFile or faSysFile or faHidden);
or
  FindAllFiles(slFiles,'/home/karen/.config/','*.*',True,faAnyFile or faSysFile);
or
  FindAllFiles(slFiles,'/home/karen/.config/','*.*',True,faAnyFile or faHidden);

Am I going wrong with that? It returns only 134 items.

[EDIT]
Ooops, it looks like 160, might be correct for FindAllFilesEx, I just realized that Nautilus is probably counting Folders too. DUH!! Not sure there are 122 Folders, but will play around in a smaller .folder.

3
General / Re: FindAllFiles not working on Ubuntu Folders
« Last post by KarenT on Today at 06:14:52 pm »
BTW, you can now use a Delphi compatible TStringList instead of TStringListUTF8 without worries.

:), thanks, I was using the Delphi style, but only tried the UTF8 version just in case and just pasted my latest code here. But, good to know.

Still cannot get it to work for more than 160 but will give the Laz-version another try with faHidden.
4
General / Re: FindAllFiles not working on Ubuntu Folders
« Last post by KarenT on Today at 06:14:37 pm »
Folders and files are probably missing because you set the parameter SearchSubDirs to false.

Thanks but I had both Boolean set to True all the time.
5
General / Re: FindAllFiles not working on Ubuntu Folders
« Last post by wp on Today at 06:11:46 pm »
Looks like 122 Folders and/or Files have gone missing.
Folders and files are probably missing because you set the parameter SearchSubDirs to false.
6
General / Re: FindAllFiles not working on Ubuntu Folders
« Last post by KarenT on Today at 06:07:47 pm »
Me too. Just coming back to say, the "True" as the last Parameter makes no difference if it is "False."
7
General / Re: FindAllFiles not working on Ubuntu Folders
« Last post by wp on Today at 05:58:37 pm »
You have to modify the unit slighty. I created an "enhanced" version of it (with the help of Engkin and Bart) which is part of QuickHash (https://github.com/tedsmith/quickhash/blob/master/FindAllFilesEnhanced.pas)

Code: [Select]
TotalFilesToExamine := FindAllFilesEx(Foldername, '*', False, True);

I copied this from the specified links:
Code: Pascal  [Select]
  1. function FindAllFilesEx(const SearchPath: string; SearchMask: string; SearchSubDirs: boolean; IncludeHiddenDirs: boolean): TStringListUTF8;  
  2. var
  3.   Searcher: TListFileSearcher;
  4. begin
  5.   Result := TStringListUTF8.Create;
  6.   Searcher := TListFileSearcher.Create(Result);
  7.   Searcher.DirectoryAttribute := Searcher.DirectoryAttribute or faHidden;
  8.   try
  9.     Searcher.Search(SearchPath, SearchMask, SearchSubDirs);
  10.   finally
  11.     Searcher.Free;
  12.   end;
  13. end;

Mabe I am missing something, but the parameter IncludeHiddenDirs does not seem to be used anywhere. The Searcher.Attribute is set as if IncludeHiddenDirs were true. So, either remove the IncludeHiddenDirs as a parameter or apply the "or faHidden" only in case of "if IncludeHiddenDirs"

Lazarus' FindAllFiles now has an optional DirAttr parameter as well. Therefore FindAllFilesEx can be emulated by or-ing the default DirAttr faDirectory with faHidden.

[EDIT]
Ah, Juha was faster...
8
General / Re: FindAllFiles not working on Ubuntu Folders
« Last post by JuhaManninen on Today at 05:57:43 pm »
You have to modify the unit slighty. I created an "enhanced" version of it (with the help of Engkin and Bart) which is part of QuickHash (https://github.com/tedsmith/quickhash/blob/master/FindAllFilesEnhanced.pas)
Your function has parameter IncludeHiddenDirs but it is not used. How can it work?
Code: Pascal  [Select]
  1. function FindAllFilesEx(const SearchPath: string; SearchMask: string;
  2.   SearchSubDirs: boolean; IncludeHiddenDirs: boolean): TStringListUTF8;
  3. var
  4.   Searcher: TListFileSearcher;
  5. begin
  6.   Result   := TStringListUTF8.Create;
  7.   Searcher := TListFileSearcher.Create(Result);
  8.   Searcher.DirectoryAttribute := Searcher.DirectoryAttribute or faHidden;
  9.   try
  10.     Searcher.Search(SearchPath, SearchMask, SearchSubDirs);
  11.   finally
  12.     Searcher.Free;
  13.   end;
  14. end;
The FindAllFiles found in LazUtils / FileUtil has parameter "DirAttr: Word" which supports all attributes including faHidden.
It should work without copying and modifying the code. ... or maybe I don't fully understand the issue.

BTW, you can now use a Delphi compatible TStringList instead of TStringListUTF8 without worries.
9
General / Re: FindAllFiles not working on Ubuntu Folders
« Last post by KarenT on Today at 05:54:32 pm »
You have to modify the unit slighty. I created an "enhanced" version of it (with the help of Engkin and Bart) which is part of QuickHash (https://github.com/tedsmith/quickhash/blob/master/FindAllFilesEnhanced.pas)

Thank you Xor-el and Gizmo. I added in FindAllFilesEx and it works better, but, not sure yet what is missing as my test list for .config shows 160 Files+Folders, but using Nautilus and Properties for .config it shows 282 items.

Looks like 122 Folders and/or Files have gone missing.

I thought I would jump back here in case I am doing something wrong before starting to list and count everything. I tried

  slFiles:=FindAllFilesEx('/home/karen/.config/','*',True,True);            <-- returned 160
and
  slFiles:=FindAllFilesEx('/home/karen/.config/','*.*',True,True);        <-- retrned 134

Code: Pascal  [Select]
  1. implementation
  2.  
  3. {$R *.lfm}
  4.  
  5. { TForm1 }
  6. uses
  7.     LazUTF8Classes, FindAllFilesEnhanced;
  8. var
  9.   slFiles : TStringListUTF8;
  10.  
  11. procedure TForm1.Button1Click(Sender: TObject);
  12. begin
  13.   slFiles:=TStringListUTF8.Create;
  14.   slFiles:=FindAllFilesEx('/home/karen/.config/','*',True,True);
  15.   lb1.Items.Assign(slFiles);
  16.   slFiles.Free;
  17.   lbl1.Caption:=IntToStr(lb1.Items.Count);
  18. end;
  19.  

10
General / Re: FindAllFiles not working on Ubuntu Folders
« Last post by Gizmo on Today at 05:20:34 pm »
You have to modify the unit slighty. I created an "enhanced" version of it (with the help of Engkin and Bart) which is part of QuickHash (https://github.com/tedsmith/quickhash/blob/master/FindAllFilesEnhanced.pas)

and then you can use it as follows for Linux to find hidden data (as seen here https://github.com/tedsmith/quickhash/blob/master/unit2.pas#L1745) :

Code: [Select]
TotalFilesToExamine := FindAllFilesEx(Foldername, '*', False, True);

Thanks Xor-el for your kind words :-) Base64 decoding is coming soon, and implemented into the latest master commit.
Pages: [1] 2 3 ... 10

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus