Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best way to rename files
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00832800
Message ID:
00833802
Vues:
24
>>>>That code snippet could be converted to VBScript, BTW.
>>>
>>>Ok, thanks, this is just what I just wrote in the other message. :)
>>
>>BTW, you might have to convert the Fox functions to public functions in the script file. While I know VB has several file parsing functions, I don't recall seeing them in the VBScript reference.
>
>This took me a while, but it works!
>
>'*******************************************
>Vbscript:
>'*******************************************
>Option Explicit
>Dim cJustName, cJustExt, cDtModified, cMonth, cDay
>Dim oFSO, oFolder, oFile
>
>Set oFSO    = CREATEOBJECT("Scripting.FileSystemObject")
>Set oFolder = oFSO.GetFolder( "C:\Temp\" )
>
>For Each oFile IN oFolder.Files
>  cJustName   = oFSO.GetBaseName( oFile.Name )
>  cJustExt    = oFSO.GetExtensionName( oFile.Name )
>
>  cMonth      = Right( "00" & Month( oFile.DateLastModified ), 2 )
>  cDay        = Right( "00" & Day( oFile.DateLastModified ), 2 )
>  cDtModified = Year( oFile.DateLastModified ) & cMonth & cDay
>  oFile.Name  = cJustName & cDtModified & "." & cJustExt
>Next
>
Andy,

I think you're working to hard. Since VBScript references all variables as variants, you might be all to concatentate without explicitly converting it. However, even if you can't you could use the FormatDateTime() function.
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform