Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Rename file does it lowercase
Message
De
14/12/2015 03:30:52
 
 
À
14/12/2015 03:03:10
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01628889
Message ID:
01628891
Vues:
104
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform