Announcement

Collapse
No announcement yet.

Script for deleting files in specified path

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Script for deleting files in specified path

    Hi all,

    Do anyone know a script that delete files in specified path.

    ex:-
    Files located in

    C:\Documents and Settings\adham\Application Data\Microsoft\Outlook

    Thanks in advance

  • #2
    Re: Script for deleting files in specified path

    Code:
    del C:\Documents and Settings\adham\Application Data\Microsoft\Outlook\*.*
    Save as a .bat file and double click on it
    Server 2000 MCP
    Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

    ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

    Comment


    • #3
      Re: Script for deleting files in specified path

      What about this little vbs?

      Code:
      Dim sFolderName, oFSO, oFolders
      
      sFolderName = "C:\Documents and Settings\adham\Application Data\Microsoft\Outlook"
      
      Set oFSO = createobject("scripting.filesystemobject")
      Set oFolders = oFSO.getfolder(sFolderName)
      ScanFolder oFolders
      
      Sub ScanFolder(oFolders)
      	Dim oFiles, oFile, oFolder, oSubFolders, oSubFolder
      	Set oSubFolders = oFolders.subfolders
      	Set oFiles = oFolders.files
      
      	For Each oFile In oFiles
      		oFile.Delete(True)
      	Next
      	
      	For Each oSubFolder In oSubFolders
      		ScanFolder oSubFolder
      		If oSubFolder.Size = 0 Then oSubFolder.Delete(True)
      	Next
      
      	Set oSubFolders = Nothing
      	Set oFiles = Nothing
      End Sub

      Comment


      • #4
        Re: Script for deleting files in specified path

        Originally posted by tonyyeb
        Code:
        del C:\Documents and Settings\adham\Application Data\Microsoft\Outlook\*.*
        Save as a .bat file and double click on it
        Even shorter :
        Code:
        del %APPDATA%\Microsoft\Outlook\*.*  /s /q
        Guy Teverovsky
        "Smith & Wesson - the original point and click interface"

        Comment

        Working...
        X