Removing non image files after bulk import

FloppyFace5

Joined: 2011-04-25
Posts: 3
Posted: Mon, 2011-04-25 08:18

i have just installed Gallery 2 and have bulk uploaded around 70Gb of images using the local server option. The import worked flawlessly but took just over 24 hours.

Now that the upload has completed, I've just realised that my directory structure was full of .DS_Store and Thumbs.db meta files, which are now inserted into many of my albums.

Is there an easy way of removing them all?

I could remove them all from the g2data directory on the server using the shell (i have root access as it is my own server), but will that cause database inconsistenies that could break my Gallery 2 installation?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2011-04-25 11:56
 
FloppyFace5

Joined: 2011-04-25
Posts: 3
Posted: Mon, 2011-04-25 17:24

Thanks suprsidr, I only had a few Thumbs.db, so was able to manually delete those. But I've just tried that for the 120 odd .DS_Store files I had and it doesn't seem to work, possibly because Gallery2 renamed the '.DS_Store' files to '_DS_Store', thus the files no longer had a file extension.

I've found a pattern in the item table that only returned these bad files, so the following SQL did the trick:

delete FROM `g2_Item`
WHERE g_canContainChildren = 0
and g_keywords is null
and g_title = ''

delete from g2_FileSystemEntity
where g_pathComponent = '_DS_Store'

I then cleaned up the files using:

cd <path/to/g2data/albums>
find . -name _DS_Store -print0 | xargs -0 rm

It's possible, that I've broken something in the database now, as there could be rouge links to the items I've purged, but everything appears to be functioning correctly now.

I'm now using the MIME extension though, to block accidental uploading of those files in the future. Thanks for the help!

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2011-04-25 19:14

I have a script which will fix any errors you encounter. You can run it on your whole gallery and it will fix any missing objects.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
FloppyFace5

Joined: 2011-04-25
Posts: 3
Posted: Mon, 2011-04-25 19:46

Many thanks.