* Receives a path, file or path+file and returns the case sensitive format. >* The getfile() and getdir() functions only return a case insensitive path/file. >* This routine must tackle that shortcoming. > >* Changes: >* 30/jun/2006 pdv Created. >* 03/sep/2009 pdv Can now also handle an URL. (added 22/dec/2009) > >FUNCTION CaseSensitive > lparameter tcPF > > local lcPF, lnFnd, ln > local array laPF[1], laDir[1] > > lcPF = '' > lnFnd = alines( laPF, m.tcPF, .t., '\' ) > > for ln = 1 to m.lnFnd > * > do case > case laPF[ m.ln ] == '' && will be the case if it is an URL, like '\\Server\Folder\File.txt' > case m.lcPF == '\\' && then simply accept the server's ref. > case substr( laPF[ m.ln ], 2, 1 ) = ':' && if root > * > laPF[ m.ln ] = upper( laPF[ m.ln ] ) && then upper case > > case adir( laDir, lcPF + '\' + laPF[ m.ln ], 'D', 1 ) = 1 && if map exists > * > laPF[ m.ln ] = laDir[ 1, 1 ] && then replace with casesensitive string > > endcase > * > lcPF = m.lcPF + laPF[ m.ln ] + '\' > next > > if right( m.tcPF, 1 ) # '\' > * > lcPF = left( m.lcPF, len( m.lcPF ) - 1 ) > endif > > RETURN m.lcPF>
lcToFile=Fullpath(Forcepath(lcToFile,lcToDir)) >> Rename (lcFromFile) To (lcToFile)>>...which turned the whole content of lcToFile into uppercase, regardless of the case in lcToFile,lcToDir. Now since lcToDir is mostly digits (it's date based), this workaround works:
lcToFile=Forcepath(lcToFile,Fullpath(lcToDir)) >> Rename (lcFromFile) To (lcToFile)>>- now only the folder is uppercase, the filename remains as it was, which is what I wanted. Still, is there a way to have FullPath() return the path as it is on disk, not uppercased? Is there an alternative? Scripting host would work as well.