bsharath
asked on
Find Duplicate folders only from 4 of my Pst's. Need to scan each and every folder name in all pst's in the outlook and get the duplicate folder names alone to an excel/txt file.
Hi,
Find Duplicate folders only from 4 of my Pst's. Need to scan each and every folder name in all pst's in the outlook and get the duplicate folder names alone to an excel/txt file.
Scan all sub folders and folders and get the duplicates. Can be 2 or more too. Need the full path shown.
REgards
Sharath
Find Duplicate folders only from 4 of my Pst's. Need to scan each and every folder name in all pst's in the outlook and get the duplicate folder names alone to an excel/txt file.
Scan all sub folders and folders and get the duplicates. Can be 2 or more too. Need the full path shown.
REgards
Sharath
ASKER
Thanks Dave i get this
the operation failed. An object could not be found...
Set MainFolder = myNamespace.Folders(Pst)
I have changed the code with 4 pst file names
the operation failed. An object could not be found...
Set MainFolder = myNamespace.Folders(Pst)
I have changed the code with 4 pst file names
Sharath,
The codde below will run over all all of your folders - lets see if this works for you before we refine it to your 4 specific psts
Cheers
Dave
The codde below will run over all all of your folders - lets see if this works for you before we refine it to your 4 specific psts
Cheers
Dave
Option Explicit
Sub FolderList()
Dim myNameSpace As Outlook.NameSpace
Dim Pst
Dim MyDic, objFSO, objTextFile
Dim MainFolder As MAPIFolder
Set objFSO = CreateObject("scripting.filesystemobject")
Set objTextFile = objFSO.createtextfile("c:\duplist.csv")
Set myNameSpace = Application.GetNamespace("MAPI")
Set MyDic = CreateObject("scripting.dictionary")
For Each Pst In myNameSpace.Folders
Set MainFolder = myNameSpace.Folders(Pst.Name)
Call ProcessFolder(MainFolder, MyDic, objTextFile)
Next
Set MyDic = Nothing
objTextFile.Close
Set objFSO = Nothing
MsgBox "Done"
End Sub
Sub ProcessFolder(ByVal MainFolder As MAPIFolder, ByVal MyDic, ByVal objTextFile)
Dim objFolder As Outlook.MAPIFolder
For Each objFolder In MainFolder.Folders
If MyDic.exists(objFolder.Name) Then
objTextFile.Write objFolder.FolderPath & "," & Right$(MyDic(objFolder.Name), Len(MyDic(objFolder.Name)) - InStr(MyDic(objFolder.Name), "|||") - 2)
objTextFile.Writeline
Else
MyDic.Add objFolder.Name, objFolder.Name & "|||" & objFolder.FolderPath
End If
Call ProcessFolder(objFolder, MyDic, objTextFile)
Next
Set objFolder = Nothing
End Sub
ASKER
Dave can we exclude the Public folders please... As it has already taken an hr to read the public folders alone...
ASKER
Dave can we exclude the Public folders please... As it has already taken an hr to read the public folders alone...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks...
Results would be if duplicate it will be seen in Colum C & D and so on?
Results would be if duplicate it will be seen in Colum C & D and so on?
ASKER
Thanks...
Results would be if duplicate it will be seen in Colum C & D and so on?
Results would be if duplicate it will be seen in Colum C & D and so on?
Column A will contain the orginal location
Column B the duplicate path
If there were say three repeat foldernames you would get
A B
orig path dup path1
x xxxx yyyy
orig path dup path2
Cheers
Dave
Column B the duplicate path
If there were say three repeat foldernames you would get
A B
orig path dup path1
x xxxx yyyy
orig path dup path2
Cheers
Dave
ASKER
Thanks a lot Dave...
Any help on the other post...
Any help on the other post...
ASKER
Thanks a lot Dave...
Any help on the other post...
Any help on the other post...
Change these lines to your PST file names
Cheers
Dave
Open in new window