[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Search all pst file in f:\ root and exclude folder

Posted on 2008-11-17
1
Medium Priority
?
544 Views
Last Modified: 2012-06-27
Hello,
My script scan or search to f:\ root any file with .pst extension and copy to another folder, but i'd like this script exclude folder F:\Documents and Settings\rgaspar\Local Settings\Application Data\Microsoft\Outlook, can i help me?
-----------------------
Option Explicit
Dim oFSO
Dim strUserName
Dim oShell
Dim oEnv
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("Wscript.Shell")
Set oEnv = oShell.Environment("SYSTEM")
strUserName = oShell.ExpandEnvironmentStrings("%username%")
 
SearchPST (oFSO.GetFolder("F:\"))
 
ExcludeFolder (oFSO.GetFolder("F:\Documents and Settings\rgaspar\Local Settings\Application Data\Microsoft\Outlook"))
'*************************************************
Sub SearchPST(objCurrentFolder)
   Dim strTemp
   Dim strOutput
   Dim objNewFolder
   Dim objFile
   On Error Resume Next
 
   For Each objFile In objCurrentFolder.Files
    strTemp = Right(objFile.Name, 4)
     If UCase(strTemp) = ".PST" Then
   wscript.echo CStr(objFile.Path)
   'oFSO.CopyFile CStr(objFile.Path), "D:\Dados\" & StrUsername & ".$$$" & "\OldPST\" & Date & " " & CStr(objFile.Name)
  End If
 Next
 
 For Each objNewFolder In objCurrentFolder.subFolders
  SearchPST (objNewFolder)
 Next
 
On Error Goto 0
 
End Sub

Thanks
0
Comment
Question by:ricgaspar
1 Comment
 
LVL 67

Accepted Solution

by:
sirbounty earned 200 total points
ID: 22984297
Should be able to replace the for loop:
For Each objNewFolder In objCurrentFolder.subFolders
  If objNewFolder <> "F:\Documents and Settings\rgaspar\Local Settings\Application Data\Microsoft\Outlook" Then SearchPST (objNewFolder)
 Next

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Integration Management Part 2
Suggested Courses

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question