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!
batch conversion
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Pupil.
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.
If i understand you correctly you are interested in something like this: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!
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
Hope you'll find some use of the code.