Advertisement
Wasif_Hasan_

RecycleFile.vbs

Sep 16th, 2020
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Function RecycleFile(strFilePath)
  2.   Dim objShell,objFolder,strFolder,strFile,arrTabs,strTab,intCount
  3.   intCount = 0
  4.   Set objShell = CreateObject("Shell.Application")
  5.   arrTabs = Split(strFilePath,"\")
  6.   strFile = arrTabs(UBound(arrTabs))
  7.   For Each strTab in arrTabs
  8.     If intCount = UBound(arrTabs) Then Exit For
  9.     strFolder = strFolder & strTab & "\"
  10.     intCount = intCount + 1
  11.   Next
  12.   Set objFolder = objShell.Namespace(strFolder)
  13.   objFolder.ParseName(strFile).InvokeVerb("delete")
  14. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement