Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FILE NAMES

Status
Not open for further replies.

HHG

Technical User
Nov 8, 2003
68
GB
Can anyone help with file names. Within a qbasic script we have a variable which holds a file name in lower case letters e.g test.txt when this is transferred onto our Sun Solaris box it writes in UPPERCASE Letters. Anyone know how I can force it so that it keep the file name in lower case. I am not a QBASIC person, so I hope someone can help.
 
As far as the Sun Solaris OS goes... I can't help you there...

You might just want to make them all UPPER CASE to begin with, unless there is some odd reason why it matters...?

As far as dealing with cases in QB...

UCASE$(String$)
Makes String$ UPPER CASE...

LCASE$(String$)
Makes String$ lower case...

for example...
Code:
File$ = "test.txt"
Print File$
File$ = UCASE$(File$)
Print File$

Hope this helps...
Josh

Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Thank you very much, we will have a go with your suggestion.
Cheers again.
 
Maybe I am misinterpreting your issue, but...

Is this a file created by the QBasic program?

If so, consider that QBasic normally can only handle files via the old DOS 8.3 naming convention, which does not support lowercase letters. No matter what you use in QBasic the final filename will still be 8.3 uppercase format. If you create such a file with QBasic you may need to rename the file with lowercase letters before transferring it or transfer the file as a lowercase-named file.

For example, in FTP from the (I assume) Windows machine use:

[tt]put FILE.TXT file.txt[/tt]

If using a "GUI FTP" client you will have to do something similar there as instead. You may have to turn on an option to be prompted for the "as" name.

Under Win 9x I recall that renaming a file from an uppercase name to the same name in lowercase sometimes did not seem to work. In such a case rename the original (uppercase) filename to an intermediate name, then to the final desired (lowercase) name:

[tt]ren FILE.TXT x.txt
ren x.txt file.txt[/tt]

The same thing works when renaming from within Windows Explorer (via right-click, Rename).
 
True...

and to do this within QBASIC, something like this *should* work...

SHELL "ren " + UCASE$(FILE$) + " x.txt"
SHELL "ren x.txt " + LCASE$(FILE$)

...if the internal QB functions do not work...

Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Hi HHG. I had the same headace problem when FTPing my site files for the first time. All my links were in lowercase, all my files were in UPPERCASE, so no links would work.

As correctly stated above by others, Qbasic can make only Short file names -- all uppercase (even if you put lowercase in the OPEN command). However, there are many free & simple tools out there that can convert a directory of files to lowercase quickly, like this one: Here's some batch files that can do the trick:

..................

Thought I'd mention this for the heck of it. Perhaps you or someone else could might make use of it...

Yes, Qbasic can only create Short, uppercase filenames, but it can handle (OPEN/PRINT/CLOSE) previously created lowercase, Long-file-names (LFN) without destroying it's LFN status.

If you created a zero-byte lowercase file with a LFN capable program beforehand, then had Qbasic to OPEN/PRINT/CLOSE it, the file would still be saved as lowercase -- at least it does for me under my Win9x machines.

- Dav

Visit my Qbasic site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top