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

How to retain file name UPPER/lower case 2

Status
Not open for further replies.

shahatul

Programmer
May 28, 2002
23
US
Dear Friends,

On my form, I have created a list box to look a specific directory which contains thousands of files. I want to see file name exactly UPPER/lower case (Originally stored) on a specific drive. I am using adir() function which is converting file name into UPPER case.

Is there any function, trick or api is available to use.

Thanks in advance

AVS
 


I believe the work around is to loop through the array and fix it:
Code:
LOCAL nCount
SET DEFAULT TO c:
nCount=ADIR(myArray,"*.*")
FOR i = 1 TO nCount
   IF !EMPTY(myarray[i,1])
      STORE PROPER(myArray[i,1]) TO myArray[i,1]
   ENDIF
NEXT


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
AVS,
I saved this sample off:
*:* Show Filenames with case preserved [vs. ADIR()]
As filenames are case-insensitive in Windows and NT, all file formats, upper case is as correct as lower or whatever. You can use the FileSystemObject to
get the names as Explorer shows them.
Code:
path = "C:/mydata/"
ofs=create('scripting.filesystemobject')
ln = ADIR(arr,path+"*.*")
FOR ii = 1 TO ln
  ? ofs.getfile(path+arr[ii,1]).name
NEXT
-Anders


Rick
 
If you are by chance using VFP 7, ADIR() has a new flag:

nHowMany = ADIR(aMyArray, '*.DBF', '', nFlag)
nFlag :
0 = Display file name uppercase
1 = Preserve case
2 = 8.3 format
Dave S.
 
Gee Dave, if you going to actually read the help file and take advantage of all the great stuff the VFP team has added with each new release, you take away all the fun of the "creative" ways of doing things! :)

Rick
 
Thanks Rick So much. I appreciate your great help and salute to your expertise.
AVS
 
Sorry, I forgot to mention that Thanks Everybody for their sharing expertise.
AVS
 
mgagnon,

PROPER() may be a sort of fix, but there are a pleny of times where user files get created with names like:

MyFile.BAK
Myfile.B4Change

and so on.


Rick,

Sometimes it just doesn't take much to entertain me!
I look up a function and slap my forehead saying, "If I would have looked this up, I probably wouldn't have had to bother writing MyFunc()."
So a lot of times when I start cranking out some massive UDF that seems to be getting more complex than simple, I
hit F1 and start poking around.
Dave S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top