Remove ".DS_Store" file from your MOD package

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
ycl6
Translator
Posts: 5696
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan
Contact:

Remove ".DS_Store" file from your MOD package

Post by ycl6 » Fri Aug 05, 2005 4:29 am

Many MODs have been repacked by the MOD Team because of .DS_Store files. In order to save us time, those of you using Macs can remove the .DS_Store files for us.

A Google search reveals this as a potentially useful tool to remove those files:

http://www.macupdate.com/info.php/id/11163

Other tips on how to remove these files are also appreciated.

AcousticJames
Registered User
Posts: 970
Joined: Wed Jul 13, 2005 5:59 am
Location: St. Cloud, MN
Contact:

Post by AcousticJames » Fri Aug 05, 2005 8:49 am

Since it's a hidden file, the easiest way to do it would be through the Terminal (/Applications/Utilities/Terminal.app) with a simple UNIX command:

cd MOD folder (replacing MOD Folder with the name of the appropriate directory)
rm .DS_Store

And that should do it. Doesn't even need to be run as sudo. Hope that helps!

James

User avatar
webmacster87
Former Team Member
Posts: 3758
Joined: Fri Jun 11, 2004 2:30 am
Location: San Mateo, CA
Name: Douglas Bell
Contact:

Post by webmacster87 » Wed Aug 10, 2005 12:50 am

Never knew about that .DS_STORE cleaner, I personally use Chop to clean out .DS_STORE files.

One thing to be aware of is that you MUST zip your MOD IMMEDIATELY after clearing out the .DS_STORE files. Mac OS X uses these files to store folder-specific Finder preferences (like the background image for your window, the size of the icons, where you were last when you scrolled the window), and if you clear the .DS_STORE files and then do something in Finder and then zip the MOD, you run a risk of the .DS_STORE files being created again--this has happened to me many times. ;) As soon as the files are deleted, Ctrl-click on the folder or click on the Action button in the Finder window and select Create Archive, BEFORE YOU DO ANYTHING ELSE. And if you have to do anything else, clear the .DS_STORE files again, it never hurts.

Another good insurance method is to double-check that the .DS_STORE files are gone. This is difficult to do in Mac OS X, since the operating system hides the files from view. However, there are some programs out there that let you display hidden files (I don't know any names off hand, but I've tried them). Many FTP clients also let you Show Hidden Files like .DS_STORE and .htaccess, etc. If you are a UNIX geek (unlike me), there is probably some scripts you can enter into Terminal to toggle the display of these files, or if you have a Windows PC lying around, open the zip on there and inspect for those pesky .DS_STORE files.

I know it's tedious, but that's what happens when your MODs are Image in a Windows world. ;)
--Fountain of Apples

AcousticJames
Registered User
Posts: 970
Joined: Wed Jul 13, 2005 5:59 am
Location: St. Cloud, MN
Contact:

Post by AcousticJames » Wed Aug 10, 2005 5:20 am

Fountain of Apples wrote: If you are a UNIX geek (unlike me), there is probably some scripts you can enter into Terminal to toggle the display of these files, or if you have a Windows PC lying around, open the zip on there and inspect for those pesky .DS_STORE files.


Well, it's not really a matter of toggling the display of hidden files. I don't think it's an option in the Finder (haven't looked yet, tho, I could be wrong). As far as using the Terminal, just add a couple of switches to the "ls" command to view hidden files:

ls -al will display all files including hidden files, as well as their permissions and other info. If you want to get geeky, you could create an alias in your .profile (or is it .login file?) file to alias "ls -al" as "ls". So a simple ls command will show you hidden files.

But you are right about archiving your MOD immediately after removing the .DS_STORE file otherwise the Finder will add a new one. I would push knowing the very simple and very easy UNIX commands to remove the .DS_STORE file as opposed to downloading and installing a separate program. Doesn't make sense to have that when a couple of simple commands in a Terminal window does the same thing. In fact, I'm fairly certain you can even archive your MOD from the command line. You could even conceivably write a small shell script that would remove the .DS_STORE file and archive the MOD all at once, resulting in only having to issue a "cd" command to the appropriate directory, running the script and there you go.

But that would only really be of use if it was something you did extremely often. I've rambled on long enough, sorry.

James

User avatar
webmacster87
Former Team Member
Posts: 3758
Joined: Fri Jun 11, 2004 2:30 am
Location: San Mateo, CA
Name: Douglas Bell
Contact:

Post by webmacster87 » Thu Aug 11, 2005 1:50 pm

Very few of us are Terminal/UNIX geeks. If we were, we'd be developing Cocoa/Carbon apps, not phpBB MODs. ;)

User avatar
Flaming_cows
Registered User
Posts: 761
Joined: Sat Jul 05, 2003 1:43 am
Contact:

Post by Flaming_cows » Thu Aug 11, 2005 2:09 pm

Fountain of Apples wrote: Very few of us are Terminal/UNIX geeks. If we were, we'd be developing Cocoa/Carbon apps, not phpBB MODs. ;)

I'm a terminal/*nix geek who makes phpBB MODs you insensitive clod!

AcousticJames
Registered User
Posts: 970
Joined: Wed Jul 13, 2005 5:59 am
Location: St. Cloud, MN
Contact:

Post by AcousticJames » Fri Aug 12, 2005 9:46 am

Flaming_cows wrote:
Fountain of Apples wrote:Very few of us are Terminal/UNIX geeks. If we were, we'd be developing Cocoa/Carbon apps, not phpBB MODs. ;)

I'm a terminal/*nix geek who makes phpBB MODs you insensitive clod!


I wouldn't call myself a Terminal/*nix geek, but close. And I used to write Cocoa apps, I'm actually rather fond of the Cocoa/Objective-C architecture. If I had any projects that called for it, I'd still be writing in it.

But we're getting off course. I would be willing, if you thought there would be any demand for it, a small shell script that would remove a .DS_STORE file and archive a folder in one shot, as well as how to run it (simple, really). But again, I don't think there would be much call for something like that.

Knowing me, tho, I'll do it anyway because I'm weird like that.

James

SandManMattSH
Registered User
Posts: 1
Joined: Mon Aug 22, 2005 4:53 am
Location: Queens, NYC, NY, USA, NA, Earth, Sol, Milky Way, Delta
Contact:

My Script

Post by SandManMattSH » Tue Aug 23, 2005 12:38 am

I'm not really a member of this forum, but I was googling for something and thought I'd help you guys out.

just type "vi ds_store_remove.sh" in Terminal, copy-paste from below, type "chmod 754" in terminal, and then type "./ds_store_remove.sh".

Heres a good script:

Code: Select all

#!/bin/bash

#************************************************#
#               ds_store_remove.sh               #
#         written by Matthew Strax-Haber         #
#            Started August 10, 2005             #
#         Last Modified August 12, 2005          #
#                                                #
#           Removes ".DS_Store" files            #
#************************************************#

declare -i I_prompt_timeout=10
declare -i Q_locatedb_def=1

S_def_prompt='\E[47;34m'"\033[1m[\033[0m"'\E[47;32m'"\033[1mYes\033[0m"'\E[47;34m'
S_def_prompt="$S_def_prompt""\033[1m]\033[0m"'\E[47;34m'"\033[1m[\033[0m"
S_def_prompt="$S_def_prompt"'\E[47;31m'"\033[1mNo\033[0m"'\E[47;34m'
S_def_prompt="$S_def_prompt""\033[1m]\033[0m"'\E[47;34m'"\033[1m[\033[0m"
S_def_prompt="$S_def_prompt"'\E[47;35m'"\033[1mQuit\033[0m"'\E[47;34m'
declare -x S_def_prompt="$S_def_prompt""\033[1m]\033[0m"

#----------------------------------------------------------------------------

function locatedb_prompt
{
   read -s -t $I_prompt_timeout -n 1
   echo ''
   case "${REPLY-Q_locatedb_def}" in
     [Yy1]) echo "$(basename $0):  Updating locate database..."
            sudo locate.updatedb 2>/dev/null                         ;;
     [Nn0]) echo "$(basename $0):  Not running locate.updatedb." >&2 ;;
     [Qq] ) echo "$(basename $0):  exiting..."                   >&2
            exit                                                     ;;
     *    ) echo "Invalid input.  Please try again."             >&2
            echo "$(basename $0):  exiting..."                   >&2
            exit $E_INV_INPUT                                        ;;
   esac
}

function kpDS { echo "keeping  $1" >&2; }
function rmDS
{
   echo "deleting $1"              >&2
   rm ${1//~//Users/matt}
}
#----------------------------------------------------------------------------
echo 'Do you want to update the locate database before continuing?' >&2
echo 'Note:  this script may run into errors if you choose not to.' >&2
echo 'IF YOU ARE NOT SURE OF WHAT YOU ARE DOING, CHOOSE "YES" !!!!' >&2
echo -en "$S_def_prompt"

locatedb_prompt >&2
echo '' >&2

B_IFS="$IFS"
IFS="${IFS// }"

ds_list="$(sudo locate \.DS_Store)"
ds_list="${ds_list//\/Users\/matt/~}"

for file in $ds_list
 do
  case "$file" in
    /.vol/*               ) kpDS "$file" >/dev/null ;;
    /dev/*                ) kpDS "$file" >/dev/null ;;
    /Network/*            ) kpDS "$file"            ;;
    ## Comment/Delete the next line if you have an external hard drive.
    /Volumes/*            ) kpDS "$file"            ;;
    /automount/*          ) kpDS "$file"            ;;
    '~'/Desktop/.DS_Store ) kpDS "$file"            ;;
    [~/]*                 ) rmDS "$file"            ;;
  esac
done
IFS="$B_IFS"
#----------------------------------------------------------------------------
#echo 'Do you want to update the database to reflect changes???'  >&2
#echo 'IF YOU ARE NOT SURE OF WHAT YOU ARE DOING, CHOOSE "NO"!!!' >&2
#echo -en "$S_def_prompt"
#locatedb_prompt >&2
#-----------------------------------------------------------------------------
exit #{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}
#-----------------------------------------------------------------------------
A simpler version would be:

Code: Select all

find . -name .DS_Store -delete
This, of course, is a LOT less code. But it isn't ANY faster (it actually is about 2 seconds out of every hour slower -- not that that matters).

Do not read below if you do not consider yourself experienced (however, please do if you want an explanation of why the long code is better than the first).

Note for those using external hard drives:
My code automatically skips the "/Volumes/" directory to avoid errors with read-only media such as CD-ROMs. If you have an external drive, you should delete (or comment out) line 68, which says:

Code: Select all

/Volumes/*            ) kpDS "$file"            ;;
Reasons why mine is better:
1. My way also serves the purpose of updating the locate database (which should be done anyway).
2. If you have updated the database already (recently), you can choose "No" at the prompt and the entire operation will take only a fraction of a second.
3. Even if you haven't updated the locate database recently, you can still choose "no" and it will remove any DS_Store files created before the last update.
4. This probably doesn't apply to anyone that isn't scripting a lot, but there are other reasons for it that involve interoperability with other scripts (I update the locate database once within this script at the beginning of my weekly cron and then other scripts run off the locate database instead of having to use find).
5. It is a lot less scary than the short code because while the script takes many minutes to complete, many users may be worried that it is doing something naughty. Mine notifies the user at each step.


~Matt
PS: Use these scripts AT YOUR OWN RISK!! I have tried to make them as bug-free as possible, but I cannot guarantee, in any way, that I have not "screwed up". Therefore, this code is provided "as-is" without any warranty or guarantee of any kind.
Last edited by SandManMattSH on Wed Aug 31, 2005 8:00 pm, edited 1 time in total.
i'm too lazy....

Xpert
Translator
Posts: 114
Joined: Fri Feb 20, 2004 8:19 pm
Location: Moscow, Russia
Contact:

Post by Xpert » Wed Aug 31, 2005 3:31 pm

There are such files at Windows XP, Thumbs.db. They store thumbnails of folder images. There are some at style pack usually :(

smithtrdon
I've Been Banned!
Posts: 14
Joined: Tue Sep 13, 2005 12:46 am

Post by smithtrdon » Sat Sep 17, 2005 9:19 pm

Hi Everyone

I don't know what is fail not think so guess try fix my bug but that is problem virus on the html.

Code: Select all

DS_STORE
How find not found 404: smithtr.bravehost.com/DS_STORE


how you think do it not make sure what is point for DS_STORE.

Please



Can you try exam on your code not sure make sense but wrong code on the language not match or fail?

AcousticJames
Registered User
Posts: 970
Joined: Wed Jul 13, 2005 5:59 am
Location: St. Cloud, MN
Contact:

Post by AcousticJames » Tue Sep 20, 2005 7:31 am

smithtrdon wrote: Hi Everyone

I don't know what is fail not think so guess try fix my bug but that is problem virus on the html.

Code: Select all

DS_STORE
How find not found 404: smithtr.bravehost.com/DS_STORE


how you think do it not make sure what is point for DS_STORE.

Please



Can you try exam on your code not sure make sense but wrong code on the language not match or fail?


I have no clue what you said, what you asked, or what your problem is. The .DS_STORE is a hidden file created by Mac OS X to "index" the directory. It stores the info for the directory such as the size, the files it contains, how big they are, information of that nature. When you create a MOD, you need to delete this .DS_STORE before you compress the file and it's contents to upload.

I hope that information helps, I'm not really sure what you are needing help on.

James

User avatar
Handyman`
Former Team Member
Posts: 1751
Joined: Thu Feb 03, 2005 8:44 pm
Contact:

Post by Handyman` » Sat Oct 01, 2005 11:39 am

What about all the mods that we download that have thumbs.db files?
That comes from windows computers. Can you also make it mandatory to have those removed.
http://startrekguide.com My Mod Queue || 1/16/10 Display Posts Anywhere 1.2.0 RC5, Cash MOD 1.0.0 b1, MOD Version Check, AJAX Chat, SEO MOD, AJAX QR, Photo Gallery
MOD Development Manager (version 0.2.0-dev with MODX Generator)

User avatar
webmacster87
Former Team Member
Posts: 3758
Joined: Fri Jun 11, 2004 2:30 am
Location: San Mateo, CA
Name: Douglas Bell
Contact:

Post by webmacster87 » Sun Jan 08, 2006 4:10 pm

The .DS_Store is REALLY easy to remove. Go to MacUpdate or VersionTracker and you'll find plenty of freeware apps to get the job done.

What I've found to be an issue is that a __MACOSX folder is also bundled. I have spent hours trying to find a way to get rid of this, trying freeware app after freeware app (which all claim to do it), but my Windows friends still say it's in there. Does anyone have any ideas of how to scrap this folder?

In the meantime, I'm putting a request on the Mac OS X Feedback page requesting that these garbage files be automatically removed when zipping something.

User avatar
webmacster87
Former Team Member
Posts: 3758
Joined: Fri Jun 11, 2004 2:30 am
Location: San Mateo, CA
Name: Douglas Bell
Contact:

Post by webmacster87 » Thu Feb 09, 2006 2:43 pm

Well, now I'm using the latest OS X 10.4.4, and the .DS_Store files seem to be not there anymore. Also, in most folders, the __MACOSX folders are gone, with the exception of one or two where they were causing trouble previously, but they don't seem to be creating themselves anymore.

I'm still keeping an eye on it before I 100% trust it, although Apple seems to have made some changes. :)

User avatar
webmacster87
Former Team Member
Posts: 3758
Joined: Fri Jun 11, 2004 2:30 am
Location: San Mateo, CA
Name: Douglas Bell
Contact:

Post by webmacster87 » Wed May 24, 2006 11:19 pm

To update:

I'm not sure where the _MACOSX are coming from, but *shrugs*. Most of the time, they don't seem to show up however.

For clearing out .DS_Store, I like to open my FTP client (I use Transmit), turn on hidden files, and delete the .DS_Store files that way. Then, just go back into the Finder and archive the folder WITHOUT OPENING IT. That seems to keep away the .DS_Store.

Post Reply

Return to “[2.0.x] MOD Writers Discussion”