[Bins] gallery cleanup script

Jochen Schaeuble psionic at psionic.de
Thu Mar 27 21:53:06 GMT 2003


Hi,
finally I've found a bit time to make some changes to the script. First
of all, I use the arrays you mentioned below. Thus the script now scans
for all web- and image-formats. The second modification is that all
directories called "static.*" are ignored.

The current implementation only prints out the filenames and directories
that should be removed. To enable the "destructive" operation remove the
hash (#) symbol before lines 36 (directories) and 63 (files). I only
recomend removing files automatically though.

I think this script should run before the new gallery is created. If the
script accidently removes a file in the destination folder that
shouldn't be removed the it's recreated if it still exists in the source
folder.

I hope you find this script useful.

Greets,
  Jochen

On Sat, Mar 01, 2003 at 09:44:26PM +0100, Jérôme SAUTRET wrote:
> On Sat, Mar 01, 2003 at 06:35:15PM +0100, Jochen Schaeuble wrote:
> > Hi,
> > I've written a simple & stupid perl script that removes left over files
> > in the gallery destination directory (i.e. if the original file was
> > renamed or removed). The current implementation doesn't actually remove
> > files. It only prints a message that a file/directory should be deleted.
> > 
> > I would be happy if someone on the list could test this script and give
> > me some feedback if it works.
> 
> Here are some remarks about the script :
> 
> Only filenames ending with .jpg and .jpg.xml are tested, but some
> images can use other extensions. Here are the graphic formats that
> bins recognizes to be published on the Web :
> 
> my @webFormats = ("JPEG", "GIF", "PNG"); # Image formats that can go
>                                          # into the web album (other
>                                          # formats will be converted
>                                          # to JPEG).
> 
> So, perhaps you can test for jpg, jpeg, gif and png. This could detect
> most of the files to be removed. Most, because there is another
> problem : bins handles others formats in the source directory :
> 
> # @knownImageExtentions defines file extensions that BINS can handle as
> # input image.
> my @knownImageExtentions = ("jpg", "jpeg", "gif", "png", "tiff",
> 			    "bmp", "tga", "ps", "eps", "fit", "pcx",
> 			    "miff", "pix", "pnm", "rgb", "im1", "xcf",
> 			    "xwd", "xpm", "avs", "dcm", "dcx", "dib",
> 			    "dps", "dpx", "epdf", "epi", "ept", "fpx",
> 			    "icb", "mat", "mtv", "pbm", "pcd", "pct",
> 			    "pdb", "ppm", "ptif", "pwp", "ras", "thm",
> 			    );
> 
> 
> So, an image can have a .jpg extension in the dest directory but
> another one in the source one. It becomes difficult when two files use
> the same name with two different extensions, like picture.jpg and
> picture.tiff. Well, bins doesn't handle that, but it should ;-)
> For now, just replacing the extension of the source image not in
> webFormats by .jpg to test it in the dest dir should be OK.
> 
> I've also noticed that the script deletes static.* directory, which
> isn't in the source directory but in the templates directory.
> 
> Anyway, I think that a clean up feature like that could be useful and
> added to bins. It can be executed after every album creation.
> 
> -- 
> Jérôme SAUTRET (Jerome @ SAUTRET.org)           http://SAUTRET.org
> Key 0x95D463F3 fingerprint 3B69 3B60 4D32 B8DF 2BF3 8035 5036 D41A 95D4 63F3
> 
> _______________________________________________
> Bins mailing list
> Bins at email-lists.org
> http://www.email-lists.org/mailman/listinfo/bins
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cleanupgallery.pl
Type: application/x-perl
Size: 2264 bytes
Desc: not available
Url : http://www.email-lists.org/pipermail/bins/attachments/20030327/c52e2e82/cleanupgallery.bin


More information about the Bins mailing list