Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 4 Jahren, 7 Monaten
Letzter Beitrag:
vor 4 Jahren, 7 Monaten
Beteiligte Autoren:
DerekT, Viggo Poulsen, Al

fCopy and colons

Startbeitrag von DerekT am 29.11.2013 18:19


This is an application written in WD15
I am storing the path of an email but having a colon in the file name is causing me an issue.

//Set the paths
srcfile is string = \\Server\Share$\\FiledEmail\Property\12128\Messages\20131023\14100650-RE: September Bulletin.msg

trgtfile = C:\Users\Derek\Documents\tempextract\14100650-RE: September Bulletin.msg

//Copy from source to target directory

//Read email
Email.Source = fLoadText(tgtfile)
IF EmailImportSource() THEN
//Do stuff

Problem is that when the is a colon in the file name I only get a 0 byte file named '14100650-RE'
And as a result fLoadText(trgtFile) fails.
If there is no colon all works as expected, unfortunately the construct of the file name beyond my control.

Any ideas or workarounds appreciated.


Hi Derek

Colon is not allowed in a filename. Try to make a textfile on your desktop, named test.txt and then rename it to te:st.txt . This is not possible.
What happens is, i guess, that the system sees it as a part of a drive, ex. c: or d: so all to the left of the colon is a drivename.

Best regards
Viggo Poulsen

von Viggo Poulsen - am 29.11.2013 18:35
Thanks for the info.:spos:

In this case the file name is constructed using the email subject - hence the occasional colon.
Of course I can remove this when saving the path but then I suspect that the fLoadText() would still fail.

von DerekT - am 29.11.2013 18:46
Hi Derek

Sorry but you should never use such subject as a filename. This time it is a colon giving some problems. Next time something else. When it comes to filenames there are a lot of characters which will give you problems.
I don't know your program but when there are a filename, there are a file. So perhaps you could put the email subject in this file and then make a unique filename instead. Or maby just exchange anything else than a..z and 0..9 with an underscore ?

Best regards
Viggo Poulsen

von Viggo Poulsen - am 29.11.2013 22:00
Hello Derek

Given that a colon is not allowed in a file name, how are they creating the file in the first place ?

Still, if the fCopyFile() can pick up the file with a colon in the name, you can change the colon to a hypen or similar in the target file name and the fLoadText() should work.


von Al - am 29.11.2013 22:20
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.