【软件自动化测试-QTP实战技能 20】== QTP_ Delete files from Temp Folder:删除Folder

Function ClearFilesFolders(strPath)

Set fso = CreateObject("Scripting.FileSystemObject")



If fso.FolderExists(strPath) Then

Set oFolder = fso.GetFolder(strPath)



For Each oFile In oFolder.files

fso.
DeleteFile oFile'Deleting Files

Next



For Each oSubFolder In oFolder.SubFolders

fso.
DeleteFolder oSubFolder'Deleting Folders

Next



Set oFolder =Nothing

End If

Set fso =Nothing

End Function



Call ClearFilesFolders("C:/Temp")'Temp folder's location may vary for different machine.

                                                    'Temp folder 可以是不同的LOCATION!

你可能感兴趣的:(c,function,测试,delete,each)