Estou precisando trocar a linha 8: strFolder = "C:\Documents and Settings"
pela linha: strFolder ="%HOMEPATH%"
Mas não funciona quando troco. Preciso declarar mais alguma coisa ?
Obrigado
#############################
OPTION EXPLICIT
DIM strExtensionsToDelete,strFolder
DIM objFSO, MaxAge, IncludeSubFolders
' ************************************************************
' Setup
' ************************************************************
' Caminho de pesquisa
strFolder = "C:\Documents and Settings"
' strFolder ="%HOMEPATH%"
' Deletar subpastas ?
includeSubfolders = true
' Vírgula para separar as extensões
strExtensionsToDelete = "mp3,wma"
' Arquivos antigos.
maxAge = 1
' ************************************************************
set objFSO = createobject("Scripting.FileSystemObject")
DeleteFiles strFolder,strExtensionsToDelete, maxAge, includeSubFolders
sub DeleteFiles(byval strDirectory,byval strExtensionsToDelete,byval maxAge,includeSubFolders)
DIM objFolder, objSubFolder, objFile
DIM strExt
set objFolder = objFSO.GetFolder(strDirectory)
for each objFile in objFolder.Files
for each strExt in SPLIT(UCASE(strExtensionsToDelete),",")
if RIGHT(UCASE(objFile.Path),LEN(strExt)+1) = "." & strExt then
IF objFile.DateLastModified < (Now - MaxAge) then
objFile.Delete
exit for
END IF
end if
next
next
if includeSubFolders = true then ' delete recursivo
for each objSubFolder in objFolder.SubFolders
DeleteFiles objSubFolder.Path,strExtensionsToDelete,maxAge, includeSubFolders
next
end if
end sub
Aldiko