Script to remove source/flavour files



someone has a script to remove all the source files from an account, or allf files from a specified flavour?. I would like to free disk space from the KMC.

thanks in advance



Hi @lluisribes,

In this thread:

You’ll find a script that outputs the asset ID and tags for each source flavour.
You can then add code to mark that flavour as deleted in the DB by calling:


The next part, deleting the file from the actual storage, is a bit more tricky because there is no API for that. Basically, you’ll need to make the following query directly to the DB:

select concat (file_root,file_path) as path  from file_sync where object_id =$flavour_asset_id;

Get the file path and remove it from disk.

I recommend you be very careful with doing that though, start by writing a script that only outputs the actions it thinks it should perform without really doing them [dry run], then review the output to make sure it makes sense, then backup the DB before taking it further and of course, when making your real run be sure to log all actions into a file. I’d also recommend backing up the actual files under /opt/kaltura/web//content/entry/data but considering your issue is lack of space this may not be an option for you.

Another important note is that w/o the source flavour, you won’t be able to regenerate the other flavours [reconvert].

Storage limits Kaltura 12.9.0

Ok Jess, thanks for the info. It’s enough to create or script. It’s help us!,