I want to came out with a program which can open folder by reading the path from textfile. When open, the code will check if there is files inside the folder. for the first file, do some calling function, it will keep doing until the last file available in the folder.
for example, if the folder A content 3 files, 1st.doc, 2nd.txt, 3rd.pdf, it will doing an operation to each files until the last file then exit.
thanks
I need idea on how to implement it, references or example from any language also are very helpful.
Im coding it in Basic:
;open textfile
$dir = "C:\Documents and Settings\admin\My Documents\AutoItCodes\"
$file = FileOpen($dir & "Setting.txt", 0)
If $file = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf
$source = FileReadLine($file,1)
$dest = FileReadLine($file,2)
$pass = FileReadLine($file,3)
FileClose($file)
;check files available in the folder $source
$search = FileFindFirstFile($source & "*.*")
; Check if the search was successful
If $search = -1 Then
MsgBox(0, "Error", "No files/directories matched the search pattern")
Exit
EndIf
;Check for the first file and display in message box
;***I belived it all start here!!***
While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
MsgBox(4096, "File:", $file)
WEnd
; Close the search handle
FileClose($search)