Zen Cart Logo
Forums / General Questions / Mass delete certain images?

Mass delete certain images?

Locked

Views: 1,422

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
18 Aug 2009, 9:03 PM
#1
kenichi avatar

kenichi

Zen Follower

Join Date:
Oct 2008
Posts:
252
Plugin Contributions:
0

Mass delete certain images?

Basically I got an email from my hosting company stating that even though they allow unlimited disk space, you're not allowed to have over 50,000 files. Which is a pretty low number.

I currently have 51,000 images in my images directory and I was wondering if there is a shortcut way to delete some of them, instead of manually deleting thousands.

Basically I have around 2 product images for each product.

XXXXX_pid.jpg and XXXXX_pidt.jpg

(XXXXX refers to various numbers and letters and XXXX_pidt.jpg is a thumbnail)

I was wondering if there would be some kind of command/program that could find all of the XXXX_pidt.jpg's and delete them for me?

Or am I SOL?

18 Aug 2009, 9:28 PM
#2
kenichi avatar

kenichi

Zen Follower

Join Date:
Oct 2008
Posts:
252
Plugin Contributions:
0

Re: Mass delete certain images?

I was thinking some kind of command to delete all "_pidt.jpg" if possible?

18 Aug 2009, 10:50 PM
#3
kiddo avatar

kiddo

Totally Zenned

Join Date:
Jul 2006
Location:
SF Bay Area
Posts:
837
Plugin Contributions:
1

Re: Mass delete certain images?

Kenichi:

I was thinking some kind of command to delete all "_pidt.jpg" if possible?

How about:

rm *_pidt.jpg

set your default to your images directory and run that and they'll be gone before you can blink.

You might want to backup your images first. Try:

tar -cvzf images.tar.gz *

inside your images dir.

Above only works if you have good hosting with shell access.

18 Aug 2009, 11:58 PM
#4
kenichi avatar

kenichi

Zen Follower

Join Date:
Oct 2008
Posts:
252
Plugin Contributions:
0

Re: Mass delete certain images?

Thanks, good to know for future reference.

I'll do the image backups, but then I'm going to just delete my images folder and upload my product images that I've mass grabbed
(http://www.zen-cart.com/forum/showpost.php?p=682618&postcount=9) since I have a lot of junk images of products I don't sell in there.

Hopefully I wont need any images in the directory besides the products xD.