Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Renaming a file goes in lowercase
Message
De
23/09/2004 14:47:17
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00945469
Message ID:
00945480
Vues:
20
>You can use Win API to preserve destination file name case. See Re: Rename a file long file name from lower to upper case Message #801674

Well, based on this, this is how I succeeded to achieve that:
DECLARE INTEGER CopyFile IN KERNEL32.DLL ;
   STRING SourceFileName, ;
   STRING DestFileName, ;
   INTEGER bFailIfExists

ADIR(laFile,'*.*','',1)
FOR lnCompteur=1 TO ALEN(laFile,1)
   lcFile=laFile[lnCompteur,1]
   lcFileNew=UPPER(SUBSTR(lcFile,1,1))+SUBSTR(lcFile,2)
   RENAME laFile[lnCompteur,1] TO (lcFileNew+'a')
   CopyFile(laFile[lnCompteur,1]+'a',lcFileNew,0)
NEXT
Then, I removed the temporary files which have been renamed in order to keep the same name.

Thanks
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform