Create a list of all folder tree of as huge 45 PST file

Page 1 of 3 123 LastLast

  1. Posts : 232
    Win 10 Ver 1903
       #1

    Create a tree-type list of folders contained in a 45+ GB PST


    The file was exported from a similarly sized working OST file. The User it belongs to is mystified at how they got so many multiple folders inside of other folders and does not really believe this is the case. I would like to print a folder-tree of the contents of her Outlook file even if it the paths are so long i have to print in 8 pt Landscape.

    Every solution I have found that is supposed to work for this is a type of compiled script add-in for Outlook and they all crash, probably due to the enormous size. I get 2 or 3 pages of output before they crash. There are probably well over 1000 folder/sub-folders and that is being optimistic. hundreds of them appear to be complete top-level folders that were copied under other 3rd or 4th level folders creating a serious mess. There could be more than 5000.

    The "folder-size" option in Outlook seems to work fine but there is no option for printed output. I can only scroll through page after page of folders.

    Does anyone know of a utility that could make a formatted output of this? Text, html or anything I can show the User. I dont want to be the one who decides what folder to merge with which but the size and complexity has got to be reduced or it will continue to get worse. She is afraid of losing email from as far back as 2005. I know how to export and can just give her the results as they are but i would like to help clean it up if possible. I believe she could do this if she had a print-out to work from.

    I have never seen one this bad and hope I never do again but if Outlook 'folder-size' can figure it out and make that long scrolling display, surely there is a way to output that content. Or capture it to a list. The only problem i see with it now is that the window in folder-size is too small to display the full path.

    Thanks for all suggestions.

    I also have the original 45 GB OST file that the PST was created from if that is a better option for input.
    Last edited by questorfla; 07 May 2019 at 01:23.
      My Computer


  2. Posts : 16,949
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #2
      My Computer


  3. Posts : 7,904
    Windows 11 Pro 64 bit
       #3

    I don't know about OST files, but for normal folders you can use TreeSize Free - select full expand then print the result to pdf file which you can edit or enclose in an email

    TreeSize Free - Quickly Scan Directory Sizes and Find Space Hogs
      My Computers


  4. Posts : 1,223
    W10-Pro 22H2
       #4

    questorfla said:
    Does anyone know of a utility that could make a formatted output of this?
    I did try a few free utilities, but all bar one were of limited use, with no output option (unless one spent money). However, this one from https://www.systoolsgroup.com/outlook-pst-reporter.html did allow me to export the list of folders to a .csv file. Be warned that (i) it requires dot-Net 2 to be installed (yuk), and (ii) it took quite a while to open my (tiny) 170MB file, so it may also blow up on your biggy.

    If that fails, I did try the VBA script supplied above, tweaked to show the number of items in each folder, and that worked fine. However, it uses a recursive function to build a large string, and that may fall over if the list is too long.

    Good luck, Martin
      My Computer


  5. Posts : 232
    Win 10 Ver 1903
    Thread Starter
       #5

    Thanks to all. I never did successfully get this to work on a 45 GB OST file most likely due to the reasons mngerhold stated. The VBA's all crashed due to the number of entries, or the length of path, or ?? Not sure but they all crash zfter a long period of running. The User in question has just had to give up and listen to reason.
    If you Slowly scroll through the Folder list option in Outlook. It plainly shows that that there are multiple redundant paths but no one will take the time to do this. Besides, there is no way to use that for any practical purpose of rearranging this to a single copy of each folder. It can be done if you have a map to work from but manually searching for all those branches is too time consuming.
    I am a surprised that MS did not include such a tool to reorganize OSTs where people have accidentally dragged and dropped multiple folders including the child-folders to a different location. I only found all these by accident as they were all under other sub-folders in Drafts. The person it belonged to though she had lost them and had create them again over years..
    I also thought of checking to see if i could get a program to do a Print-screen of the output of the scrolling folder-list window but so far, got nowhere on that either.
      My Computer


  6. Posts : 1,223
    W10-Pro 22H2
       #6

    Never one to give up (well, not immediately), your comment about grabbing the scrolling list reminded me of something I saw recently. Can't remember where, but a quick google revealed this list of possible tools: How to Capture a Scrolling Screenshot in Windows - Make Tech Easier

    Why not give them a try?
      My Computer


  7. Posts : 16,949
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #7

    This VBA code writes a text file containing a list of folders for every open Outlook file.

    Alter the line
    Code:
    strFile_Path = "D:\Desktop\OutlookFolderList.txt"
    to refer to a path & filename of your own choosing.

    Code:
    Sub ListFolders()
    ''''' taken from https://msdn.microsoft.com/en-us/lib...or=-2147217396
    Dim colStores As Outlook.Stores
    Dim oStore As Outlook.Store
    Dim oRoot As Outlook.Folder
    On Error Resume Next
    Set colStores = Application.Session.Stores
    For Each oStore In colStores
    Set oRoot = oStore.GetRootFolder
    Debug.Print (oRoot.FolderPath)
    EnumerateFolders oRoot
    Next
    End Sub
    Private Sub EnumerateFolders(ByVal oFolder As Outlook.Folder)
    Dim Folders As Outlook.Folders
    Dim Folder As Outlook.Folder
    Dim foldercount As Integer
    On Error Resume Next
    Set Folders = oFolder.Folders
    foldercount = Folders.Count
    'Check if there are any folders below oFolder
    'If foldercount Then
    For Each Folder In Folders
    Dim strFile_Path As String
    ''''' this bit from VBA write to a text file Excel
    strFile_Path = "D:\Desktop\OutlookFolderList.txt"
    Open strFile_Path For Append As #1
    Print #1, Folder.FolderPath
    Close #1
    EnumerateFolders Folder
    Next
    End Sub
    I only have a single Outlook to test this on but because it writes to a text file rather than trying to save the info in one ever expanding variable, I think it will work for your circumstances.

    Denis
    Last edited by Try3; 12 May 2019 at 07:39.
      My Computer


  8. Posts : 16,949
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #8

    This is a refined version of the above VBA code. It only lists 'chosen' Outlook folders that have contents and I think that makes it more useful because it avoids having to manually & uselessly review folders that have nothing in them.

    The output is a text file showing, for example,
    Code:
    Count of items in the '\\ForumMessages\Try3 - TenForums' folder: 721
    for those folders that contain anything. You could edit the code to change the explanatory words if you wanted or you could paste the output into, say, Excel and mess about with the results to your heart's content.

    You'll have to identify your own OutputFile where I have written
    Code:
    OutputFile = "D:\Desktop\OutlookFolderList.txt"
    and note that you will need to rename / move the OutputFile before a further run or the new results will be appended to the previous ones. Personally, I just add the DLM to the start of the file name [20190512 132918 OutlookFolderList.txt] if I am doing a further run for some unknown reason.

    Code:
    Sub ListOutlookFolders()
    'taken from https://msdn.microsoft.com/en-us/lib...or=-2147217396
    Dim colStores As Outlook.Stores
    Dim oStore As Outlook.Store
    Dim oRoot As Outlook.Folder
    Dim OutputFile As String
    On Error Resume Next
    OutputFile = "D:\Desktop\OutlookFolderList.txt"
    Open OutputFile For Append As #1
    Print #1, "Entries without an item count are not a chosen folder type, are a Deleted Items folder or have no current contents"
    Set colStores = Application.Session.Stores
    For Each oStore In colStores
    Set oRoot = oStore.GetRootFolder
    EnumerateFolders oRoot, OutputFile
    Next
    End Sub
    Private Sub EnumerateFolders(ByVal oFolder As Outlook.Folder, OutputFile As String)
    Dim Folders As Outlook.Folders
    Dim Folder As Outlook.Folder
    Dim foldercount As Integer
    On Error Resume Next
    Set Folders = oFolder.Folders
    For Each Folder In Folders
    ' Printing lines taken from VBA write to a text file Excel and https://msdn.microsoft.com/en-us/vba...or=-2147217396
    '''''''''' Print all folders
    '''''''''' The following three lines list all folders [unlike the processing further down which only lists results for folders containing anything]
    '''''Open OutputFile For Append As #1
    '''''Print #1, Folder.FolderPath
    '''''Close #1
    'Contents listing section - for chosen folders only
        ' Only process contents if they are a chosen folder type
        ' [these lines are laid out ready for different choices to be made later on - all Folder.DefaultItemType values are listed]
        ' only the remarked-out items get processed
        ' mail items
        'If Folder.DefaultItemType = 0 Then GoTo SkipItems
        ' appointments
        If Folder.DefaultItemType = 1 Then GoTo SkipItems
         ' contacts
        If Folder.DefaultItemType = 2 Then GoTo SkipItems
        ' tasks
        If Folder.DefaultItemType = 3 Then GoTo SkipItems
        ' journal items
        If Folder.DefaultItemType = 4 Then GoTo SkipItems
        ' notes
        'If Folder.DefaultItemType = 5 Then GoTo SkipItems
        ' post items
        If Folder.DefaultItemType = 6 Then GoTo SkipItems
        ' DistListItems
        If Folder.DefaultItemType = 7 Then GoTo SkipItems
        
        ' Skip all Deleted items folders
        If Folder.Name = "Deleted Items" Then GoTo SkipItems
        
            ' Only process contents if there are contents in this folder to process
            If Folder.Items.Count > 0 Then
                Open OutputFile For Append As #1
                Print #1, "Count of items in the '" & Folder.FolderPath & "' folder: " & Folder.Items.Count
                Close #1
                
                    '''''''''' Print list of folder contents
                    '''''''''' This lists all items in each of the chosen folders
                    '''''''''' But I have remarked it out [after testing it] to avoid wasting processing time on something I think I would never use
                    '''''''''' It took about 7 seconds to run for a set of Outlook files containing about 1800 items
                    '''''For Each Fred In Folder.Items
                    '''''Open OutputFile For Append As #1
                    '''''Print #1, Folder.FolderPath & "" & Fred.Subject
                    '''''Close #1
                    '''''Next
                    
            End If
            
    SkipItems:
    EnumerateFolders Folder, OutputFile
    Next
    End Sub

    The 'chosen' folders are decided in the Contents listing section - for chosen folders only section
    - Any item type can be chosen by remarking out its … SkipItems line
    - I chose emails and notes but I left in all the types so you could tailor it to your own requirements
    - Do note that these item types are really referring to the default item type for any given folder so a non-standard entry such as a calendar entry in a mail folder might or might not cause problems

    The 'chosen' folders are further refined in the Contents listing section - for chosen folders only section
    - Deleted Items folders are skipped
    - The check of contents [Folder.Items.Count] is also done here to avoid reporting 0 item counts
    - Note that the check of contents does allow subfolders that contain things to be processed even though their parent might otherwise be empty.

    There is a remarked out section Print all folders
    - I included it when testing the code
    - If you wanted a list of all folders whether or not they contained anything then you could unremark these lines

    There is a remarked out section Print list of folder contents
    - I included it when testing the code
    - In my own Outlook [3 pst files containing about 44 folders and 1800 email & notes items] it took about 7 seconds for the code to run. For the very large files you are talking about working with, the code might take until a week next Tuesday.
    - If you wanted a list of all folder contents [the Subject entry for each item] then you could unremark these lines

    I was supposed to be doing something else today but just got intrigued. Now I'll have to run the three miles to Asda.

    Denis
    Last edited by Try3; 12 May 2019 at 08:39.
      My Computer


  9. Posts : 16,949
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #9

    questorfla,

    Have you had a chance to use the second of my 12th May VBA scripts yet? I believe that it solves your problem.

    Denis
      My Computer


  10. Posts : 8,108
    windows 10
       #10

    Why not just delete the ost file it will then be rebuilt next time as ost is storred on the server and updated on the pc unlike pst which is all on the pc
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 17:20.
Find Us




Windows 10 Forums