Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Delete a hidden-readonly-system file
Message
De
21/11/2009 07:58:10
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01435925
Message ID:
01435926
Vues:
101
This message has been marked as the solution to the initial question of the thread.
Chenge the attribute first
lcFile="yourfile.ext"
If Setattr(fullpath(lcFile)),'')
   erase (lcFile)
Else
   Messagebox("Can't delete "+lcFile)
Endif
   
FUNCTION SetAttr
PARAMETER zFileName, zAttribute
zAttribute = UPPER(zAttribute)
Private nAttribute
nAttribute=0
If 'S'$zAttribute && System
   nAttribute = nAttribute + 4
Endif    
If 'H'$zAttribute && Hidden
   nAttribute = nAttribute + 2
Endif    
If 'R'$zAttribute && ReadOnly
   nAttribute = nAttribute + 1
Endif    
If 'A'$zAttribute && Archive
   nAttribute = nAttribute + 32
Endif    
If 'N'$zAttribute && Normal
   nAttribute = nAttribute + 128
Endif    
declare integer SetFileAttributes IN kernel32 STRING, INTEGER 
Return SetFileAttributes(zFileName,nAttribute)=1
>Hi all
>
>I would like to delete a known file which has hidden-readonly-system attributes set from VFP. DELETE FILE does not seem to work. I have also tried to FCLOSE(FCREATE()) the file before the DELETE FILE call but still no joy.
>
>Please advise.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform