Counting files in a folder (exclude shortcuts .lnk) Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
User avatar
andy_BSZY
Posts: 67
Joined: 13 Sep 2023, 09:52

Counting files in a folder (exclude shortcuts .lnk)

07 Oct 2023, 03:40

I would like to count the files in a folder but omit counting the shortcuts (.lnk). The code from @boiler here works very well but it also counts shortcuts in the folder, I wish it didn't count this. I would like to add to the code the option to exclude files with the extension .lnk

Code: Select all

Count := 0
Loop Files, A_Desktop "\test\*.*", "F" ; remove the R to not recurse into subfolders
	Count++
MsgBox(Count " files found.")
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Counting files in a folder (exclude shortcuts .lnk)  Topic is solved

07 Oct 2023, 03:50

Code: Select all

Count := 0
Loop Files, A_Desktop "\test\*.*", "F" ; remove the R to not recurse into subfolders
	if (A_LoopFileExt != "lnk")
		Count++
MsgBox(Count " files found.")
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
User avatar
andy_BSZY
Posts: 67
Joined: 13 Sep 2023, 09:52

Re: Counting files in a folder (exclude shortcuts .lnk)

07 Oct 2023, 03:59

@jNizM Thank you very much, it works as I wanted :thumbup:

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: kunkel321, niCode and 27 guests