coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: Maxxxie on April 01, 2007, 01:35:25 AM

Title: Bulk deleting images
Post by: Maxxxie on April 01, 2007, 01:35:25 AM
Hi all,

I have a basic coppermine installation at http://pbss.aussieclans.com.  I use the batch add feature to add hundreds of pictures at a time.  This works just fine.  However, I want to remove pictures that are greater than X number of days old.  There doesn't seem to be a feature built in to do this.  Using the "edit pictures" GUI to remove pictures would be cumbersome, so I'd prefer a way to script/automate it.

If the answer is to edit the database directly, that's fine, but I would appreciate some guidance about which tables need to be touched.  Is it just the cpg1410_pictures table?  Or is there more?  Finally, in the cpg1410_pictures table, there are two fields which look like they relate to date/age.  One is mtime and the other is ctime.  mtime appears to contain timestamps, which is great, but many of these timestamps are 0000-00-00 00:00:00, which doesn't help me select files older than such-and-such a date.  The ctime field contains values such as 1173484779.  Is there documentation somewhere about what these values mean (or even doco on the database schema)?

Any suggestions would be greatly appreciated :)

Max
Title: Re: Bulk deleting images
Post by: Stramm on April 01, 2007, 07:36:32 AM
http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#modif_alb_pics

the 'edit pics' dialog allows you to delete pics too
Title: Re: Bulk deleting images
Post by: Maxxxie on April 01, 2007, 08:53:01 AM
Really?  The edit pics function allows me to delete files, in bulk, based on the file age?  I'm not looking to delete all files, and I do not want to piecemeal select a hundred files by checking a hundred check boxes.

As I said in the original post, I'm looking to script/automate this process.  Can you assist?

Cheers,
Max.
Title: Re: Bulk deleting images
Post by: Sami on April 01, 2007, 09:35:07 AM
ctime is upload time and it is Unix timestamp (created by php time() function)
so you can create a php file and create your delete db query by uisng date() and ctime value
Title: Re: Bulk deleting images
Post by: Maxxxie on April 01, 2007, 09:38:44 AM
Thanks Sami!  :)

Max