You are viewing limited content. For full access, please sign in.

Question

Question

Delete large number of documents

asked on June 1, 2022

I'm running some tests in preparation for a large migration and cleaning things up is proving to be a bit of a headache. Are there any fast mechanisms or stored procedures to delete a large batch of documents? I have a folder with 4 million records. I'm deleting the folder itself and, frankly, couldn't even open it. After 24 hours I'm about 75% of the way through deleting (they're going to the Recycle Bin).

I'm not worried about this one; it'll finish eventually. But I'm hoping there might be a better way after the next test.

0 0

Replies

replied on June 2, 2022

Hi Pieter,

I had to go through a similar round of testing and deleting recently. Are you using the API to delete or the UI?

0 0
replied on June 2, 2022

Hi Ben-

So far, using the UI. I'm using RDP to run from the server (or a different development server) in our data center that's always on, so not as painful as trying to keep a laptop from going to sleep or having it run slowly.

Did you notice better performance using the SDK?

0 0
replied on June 2, 2022 Show version history

Yes, much much better. And can avoid the recycle bin, too.

Deleting to the recycle bin and clearing later, also means waiting for (configurable) maintenance window before you can recover disk space, as I'm sure you know. 

2 0
replied on June 7, 2022
Using oSearch As New Search(g_oLFConnection.Session)
    oSearch.Command = "{LF:tags = ""Delete Me""}"
    oSearch.Run()
    oSearchListingSettings = New SearchListingSettings
    oSearchListingSettings.CursorType = ListingCursorType.ForwardOnly
    Using oSearchResultsListing As SearchResultListing = oSearch.GetResultListing(oSearchListingSettings)
        If MsgBox(String.Format("LAST CHANCE!{0}Are you sure you want to delete {1} records?", vbNewLine, oSearchResultsListing.RowCount.ToString), MsgBoxStyle.OkCancel, "Clear Down") = MsgBoxResult.Ok Then
            For Each oEntryListingRow In oSearchResultsListing
                Try
                    Entry.Delete(oEntryListingRow(SystemColumn.Id), EntryNameOption.ForcePurge, g_oLFConnection.Session)
                Catch LFLockex As Laserfiche.RepositoryAccess.LockedObjectException
                    msgbox(LFLockex.Message)
                Catch LFex As Laserfiche.RepositoryAccess.LaserficheRepositoryException
                    msgbox(LFex.Message)
                Catch ex As Exception
                    msgbox(ex.Message)
                End Try
            Next
        End If
    End Using
End Using

 

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.