We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Splitting PST results in creation of empty folders

I am trying to split a large PST which has multiple folders with Aspose.Email for Java.
PST split works fine with size constraint; however, all PSTs will have all folders from parent PST even though some of the folders does not have messages in it.

For example, I have PST file with 3 folders- Folder_1, Folder_2, and Folder_3 with each folder of size 100 MB.
When I split PST with size restriction of 100 MB, it creates 3 PST files, with each PST with all 3 folders; even though in a specific PST, some folder does not have messages in it.


Actually, the PST content is splitted based on size to different PST file but in each splitted PST file, you will find parent PST structure. However, content will be distributed to many PST file depending on criteria.

Right, but it ends up in creating empty folders in PST. Ideally it should create folders only if there are messages in it, or this can be provided as a feature based on User’s choice.

Is there any way to avoid empty folders?


We can use Split method with criteria: API method SplitInto(IList criteria, string path)

IList<MailQuery> criteria = new List<MailQuery>();

PersonalStorageQueryBuilder pstQueryBuilder = new PersonalStorageQueryBuilder();

pstQueryBuilder = new PersonalStorageQueryBuilder();

pstQueryBuilder = new PersonalStorageQueryBuilder();

using (PersonalStorage pst = PersonalStorage.FromFile(fileName))
pst.SplitInto(criteria, path);