Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rename file does it lowercase
Message
From
14/12/2015 03:30:52
 
 
To
14/12/2015 03:03:10
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01628889
Message ID:
01628891
Views:
103
This message has been marked as the solution to the initial question of the thread.
>I wrote this piece of code because I had hundreds of files with different formatting - document names would contain the same words in different order etc, making it hard to spot the duplicates or near duplicates, so
>
>
LPARAMETERS tcGde, tcMenjaj, tcSa
>
>LOCAL lcFrom, lcTo, lnKomada
>LOCAL aa[1], i
>
>lnKomada=ADIR(aa, FORCEPATH("*.*", tcGde),"",1)
>FOR i=1 TO lnKomada
>	lcStem=aa[i,1]
>	IF ATC(tcMenjaj, lcstem)>0   && contains the string we want replaced
>		lcTo=STRTRAN(lcstem, tcMenjaj, tcSa, 1, 1, 1)
>		lcFrom=FORCEPATH(lcStem, tcGde)
>		lcTo=FORCEPATH(lcTo, tcGde)
>		RENAME (lcFrom) TO (lcTo)
>	ENDIF
>ENDFOR
>
>And it works as I intended, except that the rename command ignores the case of its parameters and I end with a filename with all lowercase. A tad better than all uppercase, but that's not what I wanted. Specially as many filenames contain names, which should be in proper case. Checked in the debugger, the lcTo contains the filename as it should be.
>
>Any ideas why, or how to fix this? I guess using scripting.filesystem would do the trick, but I'm just curious to know what's going on and whether this can be prevented.

https://www.berezniker.com/content/pages/visual-foxpro/copy-move-rename-file-preserving-destination-name-case
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform