Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Renaming files in a folder selectively
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01352035
Message ID:
01352041
Vues:
17
This message has been marked as a message which has helped to the initial question of the thread.
>Hi
>
>I have a direrctory which contains a stack of BMP files - many of the file names are wrong - I can tell if a file is wrong by looking at the first character of the file name - based on what the first character is I know what the filename should be corrected to
>
>Has anyone any code that would help me do this?
>
>Thanks
>
>Colin
RenameBadNames([c:\SomeFolder\*.BMP])


FUNCTION RenameBadNames(lcFilePattern)
    LOCAL lnFiles, laFiles[1], lnFor
    LOCAL lcFilePath
    lcFilePath = ADDBS(JUSTPATH(lcFilePattern))
    lnFiles = ADIR(laFiles, lcFilePattern)
    FOR lnForm = 1 TO m.lnFiles
        IF LEFT(laFiles[lnFor,1]) == [BADCHAR]
           lcOldName = lcFilePath+laFiles[lnFor,1]
           lcNewName = lcFilePath+[PUT THE NEW NAME HERE]
           RENAME (lcOldName) TO (lcNewName)
        ENDIF
    NEXT
RETURN .t.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform