Recent

Author Topic: [SOLVED]FindAllFiles works for folders/directories?  (Read 3449 times)

torbente

  • Sr. Member
  • ****
  • Posts: 298
    • Noso Main Page
[SOLVED]FindAllFiles works for folders/directories?
« on: January 25, 2021, 10:19:02 pm »
Hi everyone
Using Lazarus 2.0.10 on win 8.1
Im trying to create my custom file explorer.


Code: Pascal  [Select][+][-]
  1. MyDirectory : String;
  2. listaarchivos : TStringList();
  3. MyDirectory := GetCurrentDir(); // example: c:\myproject
  4. FindAllFiles(listaarchivos, MyDirectory , '*.*', false);

It only gets the files in c:\myproject, but how i can get the folders inside this folder?
« Last Edit: January 26, 2021, 02:18:34 am by torbente »
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

ASBzone

  • Hero Member
  • *****
  • Posts: 538
  • Automation leads to relaxation...
    • Free Console Utilities for Windows from BrainWaveCC
Re: FindAllFiles works for folders/directories?
« Reply #1 on: January 25, 2021, 10:37:15 pm »
https://wiki.freepascal.org/FindAllFiles

If you want to recurse subfolders, then you need FALSE to be TRUE.
-ASB: https://www.BrainWaveCC.com

Lazarus v2.0.11 r64280 / FPC v3.2.1-r48417 (via FpcUpDeluxe) -- Windows 64-bit install w/32-bit cross-compile
Primary System: Windows 10 Pro x64, Version 2009 (Build 19042)
Other Systems: Windows 10 Pro x64, Version 2009 (Build 19042) or greater

torbente

  • Sr. Member
  • ****
  • Posts: 298
    • Noso Main Page
Re: FindAllFiles works for folders/directories?
« Reply #2 on: January 25, 2021, 10:42:47 pm »
True lists the files in the subfolders of  c:\myproject
I want the name of the folders in  c:\myproject.
One image is better than 1000 words...

https://wiki.freepascal.org/FindAllFiles

If you want to recurse subfolders, then you need FALSE to be TRUE.
« Last Edit: January 25, 2021, 10:55:14 pm by torbente »
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

ASBzone

  • Hero Member
  • *****
  • Posts: 538
  • Automation leads to relaxation...
    • Free Console Utilities for Windows from BrainWaveCC
Re: FindAllFiles works for folders/directories?
« Reply #3 on: January 25, 2021, 11:15:16 pm »
Then this is what you are looking for:

https://wiki.freepascal.org/fileutil

function FindAllDirectories(const SearchPath: string;  SearchSubDirs: Boolean = True): TStringList;
-ASB: https://www.BrainWaveCC.com

Lazarus v2.0.11 r64280 / FPC v3.2.1-r48417 (via FpcUpDeluxe) -- Windows 64-bit install w/32-bit cross-compile
Primary System: Windows 10 Pro x64, Version 2009 (Build 19042)
Other Systems: Windows 10 Pro x64, Version 2009 (Build 19042) or greater

torbente

  • Sr. Member
  • ****
  • Posts: 298
    • Noso Main Page
Re: FindAllFiles works for folders/directories?
« Reply #4 on: January 26, 2021, 02:18:13 am »
Thank you!

Then this is what you are looking for:

https://wiki.freepascal.org/fileutil

function FindAllDirectories(const SearchPath: string;  SearchSubDirs: Boolean = True): TStringList;
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

 

TinyPortal © 2005-2018