Jump to content

Get Folder Name Strating with data_* from Temp Folder


Go to solution Solved by Subz,

Recommended Posts

How can I get a full name for a folder that starts with "data_" and ends with random numbers and characters?

I want to get a folders name inside Temp Directory.

Not sure how to even start. 🤭

Any suggestions? 🤔

Link to comment
Share on other sites

  • Developers
3 minutes ago, TTE26 said:

Not sure how to even start. 🤭

Maybe:

  1. Open Helpfile
  2. Search

;) 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Solution

You can put the folders into an array using _FileListToArrayRec and then loop through the array, basic example:

#include <File.au3>

Local $aTempDir = _FileListToArrayRec(@TempDir, "data_*", 2, 0, 0, 2)
If @error Then Exit MsgBox(4096, "Error", "No folders found")
For $i = 1 To $aTempDir[0]
    MsgBox(4096, "Folder", "Folder " & $i & " - " & $aTempDir[$i])
Next

 

Link to comment
Share on other sites

12 minutes ago, Subz said:

You can put the folders into an array using _FileListToArrayRec and then loop through the array, basic example:

#include <File.au3>

Local $aTempDir = _FileListToArrayRec(@TempDir, "data_*", 2, 0, 0, 2)
If @error Then Exit MsgBox(4096, "Error", "No folders found")
For $i = 1 To $aTempDir[0]
    MsgBox(4096, "Folder", "Folder " & $i & " - " & $aTempDir[$i])
Next

 


Thank you for your help. 👌

Looks like I was wrongly executing _FileListToArrayRec() function myself.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...