cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting old files

mark_mcwhinney
Champ in-the-making
Champ in-the-making
We are running Enterprise - v4.2.4 for our QA environments.  Over the last year or so, we created a lot of content.

du -sh contentstore
78G     contentstore

du -a contentstore | wc -l
1289235

I would like to delete all files that are over a month old as our testers do not need that old content.  How can this be done?
3 REPLIES 3

mark_mcwhinney
Champ in-the-making
Champ in-the-making
If I just run this would it work or cause a lot of damage?

rm -rf contentstore/2014/*

rjohnson
Star Contributor
Star Contributor
The results would be devastating. You would wreck your system.

You have 2 components that have references to the underlying files nameley the postgeSQL database and Solr indexing if you remove the files you will get mayhem as there will be pointers to missing content.

The only way to delete content is via Alfresco itself. You can automate this via java / javascript but don't delete to many at once or you will run out of transaction space. Also, to avoid these going into the trashcan you could do to add the aspect sys:temporary to each document / folder before deleting it.

You should read up on the content life cycle (there are good articles on the internet) but quickly, deleteing an item without sys:temporary moves it to trash where it stays until you delete it from there and then disappears from Alfresco and it gets moved to contentstore.deleted some days later based on config setting. With sys:temporary it does not get put in the trash and it is moved to contentstore.deleted after a period of time based on config setting.

Anything in contentstore.deleted can be deleted from the disk.

mark_mcwhinney
Champ in-the-making
Champ in-the-making
Thank you!