Delete Libraries

Patricia HeubachPatricia Heubach Administrator Posts: 37 admin

We've got a significant number of empty libraries. They are basically placeholders... just in case we ever generate files that belong in them. (Don't ask me... I didn't create them). Anyway, there are over 800 of them. Is there a quick and easy way to find and delete them without repurcussions of any kind? I can add new libraries manually when and if necessary.

Comments

  • Cwood3Cwood3 Moderator Posts: 23 mod

    I recently had a similar case where I needed to determine libraries which were empty.

    There are a couple of approaches. If you have access to your SQL database, you could do a very simple Query to find the libraries which have no documents in them, with respect to what Adept knows about.

    Another option would be to run a Powershell script which can scan from a starting point and generate a text file of all files found, including the relative path to the start point. A similar script can be run to determine the entire Directory structure. Then it would be a matter of matching up the inventory structure (inventory less files) vs the whole library structure. this could be done in Excel, Access, or SQL

    Once you have identified the empty libraries, I would recommend that the empties be deleted via the UGLA /Adept API. They could be removed via SQL but that introduces a lot of risk.

    Feel free to contact me for details on the Powershell scripts if interested

  • Gene.SewellGene.Sewell Moderator Posts: 45 mod

    New to 2018 is a command in the UGLA - delete empty libraries. This will either convert the library to a folder (which means that the web client won't display them) or remove them - if they have no children. The user choose which option to use.

  • bwalshbwalsh Moderator Posts: 8 mod

    I don't think that there's a silver bullet for this - finding the empty libraries is straight forward , the System Report (System tab - Reports - System Reports) includes a summary section for libraries which will tell you how many libraries exist in total, and the number that contain no documents and list the library names that have no documents.

    Alternatively, if you have a flat library structure, the following query will list the libraries that contain no files.

        select lib.S_NAME,lib.S_PATH
            from fm100lib lib
                left join fm100fil fil
                    on lib.S_LIBID = fil.S_LIBID
            where fil.S_LIBID is null
    

    Deleting the library completely should include removing the physical folders from disk also. The library should be removed through Adept first and then the folders cleaned up in the file system - but with 800 empty libraries that's probably going to be no fun.

    To automate this, you'd need to consider the different types of vaults, direct, ftp AFS etc. that contain the library and handle the clean up for each type.
    If this was a routine maintenance job instead of a once off, using the sdk for the library removal might make sense.

  • Gene.SewellGene.Sewell Moderator Posts: 45 mod

    Yes - it's interesting. From my perspective - as a developer - I'm thinking about the database. Delete libraries removes data from the database. I don't think it should involve removing files and folders from the vault. In fact, I'm quite paranoid about deleting a customers files or folders. If you delete the library, you can always add it back - and scan the files that are still there. You would lose the history of metadata for the files, but the files are there.
    Perhaps a feature proposal (which would make me very nervous) would be to offer to also delete the folders from the disk - but that is not something we've thought of doing up to now.

  • rnettlesrnettles Moderator Posts: 11 mod

    I see your perspective Gene and it makes a lot of sense. It is certainly more conservative for the application to take a minimalist approach towards customer's files.

    However there's also a chance to adversely affect the system by NOT deleting/cleaning up files. There used to be an option on the Delete confirmation dialog that would allow users to NOT also delete the file on disk; it defaulted to Not Delete. Our users would often not check this box, assuming it was also deleting the files. Consequently we had thousands of orphaned files/folders in our Libraries. Some of these would reappear as valid records after a Scan and Sync was performed. It also created confusion for our team later when we used the Adept File System Dashboard tool to help reconcile other non-related issues. The old deleted files muddied the picture for us and we eventually had to manually remove those orphaned files directly from the AFS Vault.

    We try to maintain a referential integrity between the database and the files in the Vault and on occasion is has been more difficult with the loose coupling between the database delete and the file delete.

    No soapbox... just another perspective. :)

Sign In or Register to comment.