Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
COPY command
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
01510543
Message ID:
01513163
Vues:
49
>>>>You can't overwrite a file which is marked as readonly.
>>>>So try this:
>>>>
>>>>oFS = CREATEOBJECT([scripting.FileSystemObject])
>>>>
>>>>SORCEFILE="C:\AA\ŠĆŠ.DOC"
>>>>TARGETFILE="C:\TMP\AA\ŠĆŠ.DOC"
>>>>TRY
>>>>  oFS.DeleteFile(TargetFile, .t.)
>>>>CATCH
>>>>ENDTRY
>>>>oFS.CopyFile(SorceFile, TargetFile, .t.)
>>>>
>>>
>>>Do you have the same code, but without using oFS (just to play safe in case it's disabled)?
>>>
>>>Thanks.
>>
>>
>>DECLARE INTEGER CopyFile IN WIN32API STRING lpExistingFileName,;
>>                                     STRING lpNewFileName,;
>>                                     INTEGER bFailIfExists
>>
>>SORCEFILE="C:\AA\ŠĆŠ.DOC"
>>TARGETFILE="C:\TMP\AA\ŠĆŠ.DOC"
>>
>>IF CopyFile(SORCEFILE, TARGETFILE, 0) # 0
>>   *** Success
>>ELSE
>>   *** Fail
>>ENDIF
>>
>
>Ok, but what about just deleting a file?
>
>I have the line of code that does COPY MEMO .. TO (lcFile)
>and therefore I think I need to delete the existing file first.


This code should overwrite the existing file.

But here one API for Delete file:
DECLARE INTEGER DeleteFile IN WIN32API STRING lpFileName

IF DeleteFile(The file name) # 0
   ** Success
ELSE
   ** Fail
ENDIF
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