Information générale
Catégorie:
Codage, syntaxe et commandes
>I want to delete all files is a user chosen dir. I use ADIR() to get a file listing and the command DELETE FILE .... to delete each file using a FOR ... NEXT loop.
>But this fails when it encounters a hidden file.
You might want to try using a filesystemobject such as:
*-- filespec is the name of the file to be played with
fs = CreateObject("Scripting.FileSystemObject")
*-- f will be a file object
f = fs.GetFile(fs.GetFileName(filespec))
*-- if the file is hidden, remove the hidden attribute
*-- this may not be necessary in order to delete
If f.attributes and 2
f.attributes = f.attributes - 2
EndIf
*-- pass the force parameter to force a delete even if
*-- the file is read-only
*-- this could also be done be checking the readonly attribute (
*-- f.attributes and 1
f.delete(.t.)
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement