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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RENAME changes upper to lower

Status
Not open for further replies.

k2a

Programmer
Jun 26, 2012
133
DE
Renaming files changes uppercase to lowercase, such as

lcCSVname = "0207986742_EUR_20161026_100259.csv“
lcNewCSVname = "E1-0207986742-25AUG2016-26OCT2016.CSV“
RENAME &lcCSVname TO &lcNewCSVname

Result e1-0207986742-25okt2016-26okt2016.csv

Is there a way to force it to uppercase?

Klaus
 
I'm glad you've got it working, Klaus, although I still don't understand why it didn't work first time round. As Olaf said, that could have been because of some Windows setting or version difference.

I noticed the following Registry setting:
[tt]
HKEY_CURRENT_USER \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Explorer \ Advanced \ DontPrettyPath[/tt]

If set to 0, this displays the filename in lower case; if set to 1, it retains the case that you specified. However, it looks like it only applies to the filename as displayed in Windows Explorer (or equivalent folder windows). As I said before, if you retrieve a filename from within VFP, it always shows up in caps.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Well, Klaus, I already gavce you the reason your twofold experiment was indeed doing the same thing twice. You did add the path to lcNewFileName for the first RUN and didn't remove it for the second RUN. Not doing anything to lcNewFileName, as I suggested, of course only works, if you didn't add the path beforehand. If you start with the same initialisation for the second RUN.

Bye, Olaf.
 
Thanks all of you for the great help!!!

I'm really glad that all the time we have spent was not useless and finally came to a successful end.
Next time i'll better listen more carefully to the experts.

Best regards
Klaus

 
MikeLewis said:
In VFP, filenames always shows up in upper case - at least, in functions such as ADIR()

As a minor side note, the ADIR() function's 4th parameter nFlag can allow the pass through of the file's case. Available option but generally no need for it in most cases. But be aware that if you do then the 3rd parameter needs content even if only an empty string.
0 (Default) Display represents the full file name in uppercase
1 Display represents original Case in names
2 Display follows DOS 8+3 naming convention

Oops, after all that I noticed Olaf used the 4th parameter too. Oh well, I'll leave this anyway.

Here's the code I had in my toolbox:
Code:
cOriginal = "C:\test\ab_sample.dbf"
cNewCase  = "C:\test\AB_Sample.dbf"

objFSO = CreateObject('Scripting.FileSystemObject')
objFSO.MoveFile(cOriginal,cNewCase)
RELEASE objFSO

Doug Hennig's blogspot post on 02/04/2010 described how to do similarly for paths.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top