Export-Mailbox for legal discovery remove empty folders

Hi Everyone,
I'm having a bit of an issue with running an export mailbox search for a legal discovery that we need to perform. Basically we need to find any messages sent from two specific addresses to anyone within our company and export them to a mailbox for our legal
team to review. The problem that i'm running into is that the export-mailbox command copies the folder structure for each mailbox that it searches to the target mailbox. When the legal team attempts to open the mailbox its taking an extremely long
time for the target mailbox to open. 
Is there any way to run the export-mailbox command and have it not copy the folder structure for users that have no messages related to the search ? I haven't been able to find anything about a command line option to not create empty folders so i'm assuming
this isn't a built in feature. If not has anyone had to deal with this issue before, if so what solution did you use to delete the empty folders folders in the target mailbox ? 
We are running Exchange 2007 SP1

Hi Ragharam,
Thank you for the response. Unfortunately the command cannot be limited to just the inbox as i must search deleted items and any folders that the users created as well as the inbox. Pretty much i have to search every where for any existence of
these messages.  I'm running a command that is similar to what you listed above and the export is working the problem is that we have roughly 5000 user mailboxes that we need to search. Since the export-mailbox command creates a folder for each
user that has been searched in the target mailbox and that folder contains each users folder structures the resulting mailbox or PST file pretty much just hangs the Outlook client as soon as its opened. 
My hope is that there would be some way to only create folders for users that have matches to the search filter and not for the users that do not match or some way to delete the empty folders within the mailbox without having to open it. 

Similar Messages

  • Remove empty folders revisited

    Hi,
    A while back I did start using this to remove empty folders inside a download folder ( thanks tot Bob for the time delay )
    /usr/bin/find $dlDir -depth -empty -type d -Bmin +2880 -exec rmdir {} ;
    Now, I need to remove folders inside many projects folder, but this isn't working for folders where a .DS_Store file lives inside.
    I could loop in each folder to check for a 1 file count ( or for more .xxx files ), but this will take time.
    How can I do that in a faster way?
    I dont want to remove any .DS_Store file from a folder that isn't empty with other files.
    Thanks in advance
    ( I know how to do it in applescript, but, I need/want it in bash )

    So I could replace eventually
    echo rm -f "$dir/.DS_Store" # remove the 'echo' when you think it is safe
    echo rmdir "$dir"
    with I guess.
    echo rm -rf "$dir" # remove the 'echo' when you think it is safe
    But will try that, the above, later.
    I thought about using rm -rf, but I worry about accidentally getting a wrong path, and deleting too much. Years ago, I wrote a script (similar concept to what you are trying to do), that was suppose to clean up a scratch area. I made a mistake in my script and cleaned out /etc/. The system was essentially hosed and I had to restore from backups.
    While I do use rm -rf, I am very careful about when I use it. It is also why I just 'echo'ed out the rm commands, rather than execute them during testing.
    If I have the wrong directory somehow, rm -f .DS_Store and rmdir "$dir" will do the minimum amount of damage, as the rmdir will not delete a directory unless it is empty, so my only loss would be the .DS_Store.
    Also I could replace
    '! -iname .DS_Store' with '! -iname ".*"' for searching and keeping out of the $files var any 'just hidden files' in the folder, right?
    Yes that should work, but I think you want to understand what dot files are there any why.
    as each directory found will be searched for files besides .DS_Store, but I could not figure out a way to do this all within the single 'find' command that was not messy.
    This was my fear, so I ask the pro's! , but I see there is not a real choice without looping.
    There may be a way, I just could not think of a cool trick that would do it.

  • How do I search for and remove empty folders?

    I would love any help. I've spent about 6 hours yesterday looking for a solution for this project...
    PROBLEM:
    I'm trying to organize a 6GB file library of sheet music documents.
    After using Gemini to find and delete duplicate files, I'm left with hundreds of empty folders and files spread across the folders in odd locations.
    How do I find and delete all the empty folders?
    My hope is to remove all the empty folders and then manually reorganize the files.
    This will probably take quite a few hours.
    Here is an example of the mess. The folders currently look something like this:
    Music Library 1 > Kids Songs > Easy > Empty Folder
    Music Library 2 > Kids Songs > Easy > "Ode To Joy.mus" and other files are here
    Music Library 3 > Kids Songs > Intermediate > Intermediate songs files are here
    A better / larger question might be - What is the best way to organize this mess?
    Is there a good file manager for organizing these documents? We run a music school and are trying to set it up for multiple teachers to organize their files and sort by a few different tags like: Difficulty, Genre, Teacher Name, Composer name etc.
    Thank you so much for any help!

    I'm afraid the ability to find empty folders is a wee bit complicated, and quite simply is completely broken in Mavericks. Just because a folder appears to be empty, doesn't mean that it is--if it was ever opened it will have an invisible .DS-Store file inside. For instance, in Snow Leopard if I do a search on the Desktop folder for Kind is Folder, plus Number of Items is less than two, I get two folders, both are empty but one I just created and never opened, and the other I created some time ago and later tossed the contents, which means that it has a .DS-Store file. Both show "No Items" in Icon view. If I modify the Number of Items to "equals 0" only the newly created and unopened folder "empty" shows up. If I try the same thing in Mavericks I get no sensible results at all in any set of search parameters.
    The moderator at Houdah Software reports: "Spotlight on Mavericks reports a value of 1 for "Number of Items" (kMDItemFSNodeCount) for all folders." He says he has reported it as a bug. Evidently it is not yet fixed.
    Francine

  • Export-Mailbox for a list of users in a specified OU

    Hi,
    I am going to implement outlook autoarchive policy for a list of users in a specific OU or CSV.
    I want to export their mailboxes through Export-mailbox cmdlet to PST for a safer side before applying this policy.
    I also have a requirement to export the last year mails of some users to PST(another query) and then remove those mails from mailbox, kindly help if this could also be done by taking the input from a OU or a csv file.
    Regards
    Supreet Singh

    Export-Mailbox : Error was found for (USERNAME ALIAS) (USERNAME_EMAIL) because: Error occurred in the step: Moving messages. Failed to copy
    messages to the destination mailbox store with error:
    MAPI or an unspecified service provider.
    ID no: 00000000-0000-00000000, error code: -1056749164
    At line:1 char:78
    + Get-Mailbox -OrganizationalUnit "OU NAME" | Export-Mailbox
      <<<< -PSTFolderPath F:\pstexports
    This is what I get when I run the command
    get-mailbox -OrganizationalUnit "OU NAME" | Export-Mailbox -PSTFolderPath F:\pstexports
    Can anyone help me get around this?

  • Remove Empty Folders by name

    Hi guys!
    i must remove all empty folders in my PC.
    Each folder can be removed only if folder start-name is not 0 or 1 or scan.
    Examples:
    C:\Scan --> keep
    C:\Scan\Try -->delete try and subfolders, keep scan
    C:\Scan\0-Try --> keep all
    C:\Try -->delete all
    C:\Try\1-This\2-That -->delete only 2-that 
    i made this code:
    function Move-EmptyDir{
    [CmdletBinding()]
    param (
    [Parameter(Mandatory = $true)][string]$Source,
    [Parameter(Mandatory = $true)][string]$Destination,
    [ValidateNotNullOrEmpty()][regex]$NoMatch
    $EmptyFolders=@()
    $AllFolders= (Dir $Source -Force -Recurse) | Where-Object{$_.Attributes -match "Directory"}
    $ExistFolders= $AllFolders | Group-Object -Property Exists | Where-Object{$_.Name -match "True"}
    Foreach($Item in $ExistFolders.Group){
    $MeltinCount= $Item.GetFileSystemInfos().count #se 0 non ha elementi
    $SimCount= (($ExistFolders.Group | Group-Object -Property Parent) | Where-Object{$_.Name -eq $Item.Name}).Count #0=no subfolders
    if($MeltinCount -eq $SimCount){
    $EmptyFolders+= $Item
    $Moved= @()
    $Moving= $EmptyFolders.Length -1
    While($Moving -ne -1){
    $OneFolder= $EmptyFolders[$Moving]
    if($OneFolder.GetFileSystemInfos().count -gt 0){
    Write-Warning "This Folder $OneFolder is not empty"
    $Moving--
    elseif($OneFolder.Name -match $NoMatch){
    Write-Warning "The Folder $OneFolder Match the Exceptions"
    $Moving--
    elseif($OneFolder.Parent.Name -match $NoMatch){
    Write-Host "The Parent Folder of $OneFolder Match the Exceptions" -BackgroundColor Green
    $Moved += $OneFolder
    $Place = $OneFolder.FullName -replace "^$([regex]::Escape($Source))", $Destination
    if((Test-Path $Place) -eq $false){
    New-Item -Path $Place -ItemType Directory
    Remove-Item -Path $OneFolder.fullname -Force -ErrorAction SilentlyContinue
    Write-Verbose ('Moved folder "{0}" to "{1}"' -f $OneFolder.FullName, $Place)
    $Moving --
    else{
    Remove-Item -Path $OneFolder.FullName -Force -ErrorAction SilentlyContinue
    $Moving --
    else{
    $Moved += $OneFolder
    $Place = $OneFolder.FullName -replace "^$([regex]::Escape($Source))", $Destination
    if((Test-Path $Place) -eq $false){
    New-Item -Path $Place -ItemType Directory
    Remove-Item -Path $OneFolder.fullname -Force -ErrorAction SilentlyContinue
    Write-Verbose ('Moved folder "{0}" to "{1}"' -f $OneFolder.FullName, $Place)
    $Moving --
    else{
    Remove-Item -Path $OneFolder.fullname -Force -ErrorAction SilentlyContinue
    $Moving --
    return $Moved
    $Where= 'C:\temp'
    $ToGo= 'C:\estinto'
    $MatchList= '0','1','8','9','Scansion'
    $Kind= 'Empty'
    if(Test-Path $Where){
    #$TheMatch = Select-Match -FullList $MatchList
    $Folders = Move-EmptyDir -Source $Where -Destination $ToGo -NoMatch 'F' -Verbose
    $Drives = ForEach($Item in $Folders){
    Select-Object -Property @(
    @{ Name = 'Name'; Expression = { $Item.Name } }
    @{ Name = 'Percorso'; Expression = { $Item.Parent.FullName } }
    #Get-Report $Drives $Kind
    else{
    Write-Error 'Invalid Path' -Category ResourceUnavailable
    with powershell v4 can you do somthing better?
    Thanks
    A

    As far as reducing the amount of code start with this:
    #return all folders that match name rules
    dir c:\temp\* -exclude 1*,0*,scan* -directory
    ¯\_(ツ)_/¯
    $Folders=Get-ChildItemD:\-Recurse-Directory-Exclude0*,1*,2*,8*,9*,scan*-ErrorActionSilentlyContinue
    $EmptyFolders
    =$Folders|Where-Object{$_.GetFileSystemInfos().Count
    -eq0}
    -ErrorActionSilentlyContinue
    $EmptyFoldersFullname
    =$EmptyFolders|Group-Object-PropertyFullname
    Get-Report
    $EmptyFoldersFullname.Group
    "Empty"
    DONE!

  • When exporting mailboxes in Mavericks no mail gets exported...only the folder. This is only on my Gmail account not my iCloud account.

    I archive client mail folders for legal purposes. I have been exporting mailboxes for quite some time with my Gmail account all email within the mailbox would export. Since I have upgraded to Mavericks...the eport mailbox function will now only export the folder (Mailbox) however no email will export.
    I have tried exporting my iCloud inbox and icloud exports just fine. Could this be more of the Gmail issue that some of us have been experiencing since upgrading to Mavericks? 

    This does look like a bug, though the workaround I'm using is to create a new mailbox and use 'On My Mac' as the destination. Then, select all the messages in the gmail mailbox folder that you need to archive and drag them into the new one you've created (dragging the enclosing folder icon will not work). This will then archive in the normal way.

  • Empty Folders on Time Capsule

    Is there a way for me to find empty folders on my time capsule without looking in each one? I have all my music on there and know some of the folders/albums contain no files/songs. Thanks!

    None that I know about.. you just have to open them..
    But the issue is Yosemite more than TC in all likelihood.
    Files are often hidden as Yosemite has poor poor networking.
    Reboot the whole network.. no luck reset the TC back to factory as that has fixed the problem.

  • Need to export selected Mailboxes as part of legal discovery

    I need to copy certain selected mailboxes/messages as part of legal discovery.
    For the life of me I cannot find how to do it in an efficient manner.  If I export as .pdf files, the attachments are not included.  If I export as .mbox nothing seems to open it except as a text file and there is too much "language" mixed in.
    I can drag one message at a time as an .eml - which could be opened by most programmes.  But if I select more than one email, I cannot copy, drag or whatever - it just won't do it - and I have several thousand emails in about ten folders/boxes that I need to hand over.
    Can anyone think of a method/piece of third party software/etc that can get this job accomplished please?

    Megs method gets you the text, but not attachments and they will be individual files, they will not be seperated by folder.
    You can also try this method:
    Select a group of emails (no need to expand threads), say, all of February, and choose Save As. At the bottom of the Save As window, set the Format pop-up to Rich Text. Mail will then save the selected messages (expanding threads as necessary) to a single RTF file, including images, audio attachments, etc.
    The original folder structure will not be preserved however.
    The Alternate Method that I used in these circumstances.
    Having verified that .mbox is a standard format, readable by many email clients I exported the requested mailboxes to .mbox format and instructed my attorney to tell their attorney to get up to date. I had provided an industry standard format containing all the information requested. Reading it was a job for them and their IT dept.

  • I am anew user. Initially I created several folders for my photos but now know how to transfer photo folders using iTunes. However I am unable to delete/remove the now empty folders I created in iPad.

    I am anew user.
    Initially I created several folders for my photos on the iPad itself but now know how to transfer photo folders using iTunes. However I am unable to delete/remove the now empty folders I created in iPad.
    Can anyone assist me please
    Thanks

    When you are in Album view in the Photos app - tap the edit button in the upper right corner - tap the X in the corner of the album to delete it.

  • How do I remove expand / collapse icon for JTree empty folders

    Hi
    I am using a JTree as a file system browser. I use DefaultMutableTreeNode nodes.
    I have a problem with empty folders.
    Empty folders show the expand / collapse icon, leading the user to believe there are sub-directories. When the user double-clicks the folder, the expand / collapse icon goes away. This is a "haha-gotcha" glitch that I really don't want my users to have to continually deal with.
    So, how might I get my JTree to not show the expand / collapse icon for empty folders?
    Thanks
    Wayne

    Maybe I can use the FileSystemView isTraversable(File f) method in my TreeCellRenderer class to check if anything is in the directory.
    But I still need to know how to disable the expand / collapse icon for such a node.

  • I have 40 empty folders in my mailbox on ipad 3. They are shown on the left hand side of my mailbox screen.I have tried to delete them but they keep re appearing should they be there or can anyone tell me how to delete them. .

    I have 40 empty folders which have appeared in my mailbox. I have tried to delete them using the edit button but they keep coming back. I have done a factory reset to start my ipad as new but this has not removed them. They have now appeared on my wifes ipad air. Can anyone help please.

    Hi Go to Settings Email Accounts Delete Accounts Then add them back again. If that doesn't work Do a Factory Restore. Cheers Brian

  • Cannot remote Mailbox Search after Discovery Mailbox was removed.

    I was trying to remove the mailbox search by running
    Remove-MailboxSearch "test" -Verbose and got the following error:
    Can't remove mailbox search 'test' because there is still at least one mailbox on In-Place Hold.
    The, I tried to run Set-MailboxSearch "In-Place Hold" -SourceMailboxes "ttesttwo" -InPlaceHoldEnabled $false and got the following error
    Couldn't find the mailbox "/o=ExchangeLabs/ou=Exchange Administrative Group
    (**)/cn=Recipients/cn=***" specified as the target mailbox for search 'test'.
    My mistake was that I deleted the discovery mailbox.  I went ahead and recreated the discovery mailbox with the same name but the LegacyExchangeDN does not match.
    How do I go about changing the legacyExchangeDN in O365?  Any other way to delete the mailbox search?
    Thanks

    Please try Set-MailboxSearch -Name Searchname -InPlaceHoldEnabled:$false
    And then confirm the status.

  • What's the difference in Apple Mail using "On My Mac" folders vs Export Mailbox?

    What's the difference in Apple Mail using "On My Mac" folders vs Export Mailbox?

    One (On My Mac) is a set of folders, the other is a way to export a mailbox for archiving or transfer to another machine.
    What do you want to do, these are not even similar.

  • Empty folders (from previews) after removing files

    I see that LR still creates a separate folder for every preview, and that all the folders remain on disk even after you've removed images from the library, leaving hundreds or thousands of empty folders behind. On the PC, there is a freeware app called RED (remove empty directories) that works well. Run it on the Lightroom folder in My Pictures.

    Thanks Frank for your prompt reply, when I click empty trash, it got rid of all the pictures in trash, but on the empty folders, however whe i exited the program adn restarted it again, the folders were gone as well.
    Thanks again for your help

  • How do I archive or 'export' mailbox folders to DOCUMENTS?

    How do I archive or 'export' mailbox folders to DOCUMENTS?

    Hey there BethWB,
    It sounds like you are wanting to export your Emails as files, rather than archiving your entire mailbox in one file. You can do that in a few ways, and this article will help you do that in Mavericks:
    Mail (Mavericks): Save messages as files or PDFs
    http://support.apple.com/kb/PH14913
    To save messages as files to use in other apps, select one or more messages or conversations, then choose File > Save As.Rich Text Format retains formatting, but Plain Text does not. Raw Message Source saves messages in mbox format, which can be imported into Mail and most other email apps. With Raw Message Source, the header is visible and an encoded version of attachments is retained.
    To save messages as PDF documents, select one or more messages, then choose File > Export as PDF.
    To save a single message in mbox format, drag the message onto your desktop. To reopen the message in Mail, double-click the file.
    If you ARE wanting to archive the entire mailbox to one file, this will help you do that:
    Mail (Mavericks): Archive messages
    http://support.apple.com/kb/PH14894
    Thank you for using Apple Support Communities.
    All the best,
    Sterling

Maybe you are looking for