Page 1 of 1
Posted: Thu May 09, 2002 11:57 am
by BackupUser
Restored from previous forum. Originally posted by willinyork.
Hi there. I am going to try to write a simple batch converter. Can anyone offer my some advice/example of taking a list of files (or the contents of a directory) and then converting each of those filename (including extension) to a string? Thank you for your help!
Posted: Thu May 09, 2002 12:34 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.
Hi there. I am going to try to write a simple batch converter. Can anyone offer my some advice/example of taking a list of files (or the contents of a directory) and then converting each of those filename (including extension) to a string? Thank you for your help!
If i understand you correctly you are interested in something like this:
Code: Select all
EOL.s = Chr(13) + Chr(10) ; End Of Line
path.s = PathRequester("Select directory.", path)
If path
If ExamineDirectory(0, path, "*.*")
files.s = ""
Repeat
type.l = NextDirectoryEntry()
If type
files + DirectoryEntryName()
If type = 2
files + " "
EndIf
files + EOL
EndIf
Until type = 0
If CreateFile(0,"dircontent.txt") ; Creates 'dircontent.txt' in the apps dir.
WriteString(files)
CloseFile(0)
EndIf
EndIf
EndIf
End
This small code snipped basicly asks you to choose a directory and then iterates through the entrys in this directory and adds those entrys to a string and finaly saves the whole string to a file.
Hope you'll find some use of the code.