Get files name in a folder

If you need to get the names of all files in a specific folder (say to put them on your invoice), it can sometimes be a long process when you have many files...

 

Here is a script that gets them all in the clipboard:

 

#IfWinNotActive ahk_class CabinetWClass

;press on Win+F2 to run the macro
#F2::

FolderSizeKB = 0
FileSelectFolder, WhichFolder ; Ask the user to pick a folder.

clipboard = ; Empty the clipboard.
Msgbox % list_files(WhichFolder)

clipboard = % list_files(WhichFolder)

;list_files(Directory)
;{
; files =
; Loop %Directory%\*.*
; {
; files = %files%`n%A_LoopFileName%
; }
; return files
;}

list_files(Directory)
{
files =
Loop %Directory%\*.*
{
if (files = "")
{
files = %A_LoopFileName%
} else
{
files = %files%; %A_LoopFileName%
}
}
return files
}
return

Parents Reply Children