Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Lowercase letters forced by RENAME?
Message
 
 
À
29/11/2000 16:27:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00446557
Message ID:
00447288
Vues:
14
David,

This is from MSDN Help: (shows VB code, but can be easily converted to VFP code):
MoveFile Method
Moves one or more files from one location to another.

object.MoveFile source, destination

Arguments
object

Required. Always the name of a FileSystemObject.

source

Required. The path to the file or files to be moved. The source argument string can contain wildcard characters in the last path component only.

destination

Required. The path where the file or files are to be moved. The destination argument can't contain wildcard characters.

Remarks
If source contains wildcards or destination ends with a path separator (\), it is assumed that destination specifies an existing folder in which to move the matching files. Otherwise, destination is assumed to be the name of a destination file to create. In either case, three things can happen when an individual file is moved:

If destination does not exist, the file gets moved. This is the usual case.
If destination is an existing file, an error occurs.
If destination is a directory, an error occurs.
An error also occurs if a wildcard character that is used in source doesn't match any files. The MoveFile method stops on the first error it encounters. No attempt is made to roll back any changes made before the error occurs.

The following example illustrates use of the MoveFile method:

Sub MoveAFile(Drivespec)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.MoveFile Drivespec, "c:\windows\desktop\"
End Sub


>>>The RENAME command seems to force file names to have lower case letters.
>>>
>>>The following snippet
>>>
>>>
>>>cname1 = getfile()           &&select a file
>>>cname2 = justpath(cname1) + '\BIGLETTERS.' + justext(cname1)
>>>?cname2                            &&yep!  They're all caps!
>>>rename '&cname1' to '&cname2'
>>>getfile()               &&reveals new filename is lowercase
>>>
>>>
>>>Using the alternative:
>>>
>>>rename (cname1) to (cname2)
>>>
>>>does not help.
>>>
>>>It's not a really big deal, but being a control freak, I want the damn thing to do what I tell it to do (damn it!).
>>>
>>>What gives?
>>
>>Have you tried:
>>MoveFiles – MoveFiles has two uses: moving and renaming. ...
>
>Useful information, but in this case my main interest is explicit control of
>the case of alphabetic characters in a file name. I'll try Movefiles to see
>if it gives me this control.
>
>BTW, apparently RENAME can accept wildcards in the filenames also. Not sure if
>it's as flexible as MoveFiles, but it does seem to have the capability.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform