Faster way to get a folder content?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
drawback
Posts: 34
Joined: 11 Aug 2016, 11:31

Faster way to get a folder content?

06 Sep 2016, 14:45

Hi,

I want to retrieve the content of a folder (about 20k files / folders) and store it in a `n-separated list
I know how to do it within a loop, but I'd like to ask if there is any method that accomplishes the job faster (than a file / folder loop)?

I need only
a.) The file names (with extension but without their path)
b.) The folder names (without their path)

No attributes or anything else...

I'm doing some regexreplace's on that list afterwards...
vsub
Posts: 541
Joined: 29 Sep 2015, 03:39

Re: Faster way to get a folder content?

07 Sep 2016, 11:32

You can use Everything to create the list,save it to file,use FileRead to put it into a variable and do what you want with it with SplitPath

For example:
FileRead, OutputVar, Filename.txt

Loop,Parse,OutputVar,`n
{
SplitPath,A_LoopField, , Dir, , Name
Names .= Name "`n"
Paths .= Dir "`n"
}

Clipboard := Names "`n______________________`n" Paths
drawback
Posts: 34
Joined: 11 Aug 2016, 11:31

Re: Faster way to get a folder content?

07 Sep 2016, 13:16

Thank you, but using an external application isn't what I really meant by "any method" :)
vsub
Posts: 541
Joined: 29 Sep 2015, 03:39

Re: Faster way to get a folder content?

07 Sep 2016, 14:28

If AHK can't read the MFT(Master File Table),then you will not find a faster way that using loop.
I made a txt file containing all of my files and folders on my both hdds(323918 files and 36742 folders)in less than 2 seconds...the program can also be run from command line

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww, OrangeCat, ShatterCoder and 85 guests