Code covered by the BSD License  

Highlights from
cleanmacpollution

5.0

5.0 | 1 rating Rate this file 3 Downloads (last 30 days) File Size: 1.6 KB File ID: #18077

cleanmacpollution

by Siyi Deng

 

20 Dec 2007 (Updated 20 Dec 2007)

delete mac os garbage files

| Watch this File

File Information
Description

MAC OS has the bad habit of creating garbage finder data file in every directory it touches. Usually this means your flashdrive will be polluted by numerous unwanted files once you've plugged it into a mac.

On OS 9 these garbages are FINDER.DAT; on OS X they are .DS_Store;

Use this litte tool to remove those unwanted files;

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
20 Dec 2007 John D'Errico

At first I thought this was just a tool that did the same thing as an existing, but very useful tool:

http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=15003&objectType=file

gipper.m removes these unwanted files in the act of creating a zip file for upload. This is indeed quite useful.

After looking more closely, I realized that this submission tries to remove the files from the directory itself. Since these files are invisible on the mac, it matters not as long as you stay there. For those of you with a flash drive or a networked drive, the .DS_store files can be irritating. So this would seem to be good.

I like the help here, it seems entirely reasonable as code. However, when I tried to run this utility, I got an error:

??? Attempted to access q(1,2); index out of bounds because size(q)=[2,1].

Error in ==> cleanmacpollution at 22
        thePath = [s(q(1,k):q(2,k)),filesep];

I won't give this any rating at all, since its possible that I used the tool improperly. (I don't think that is true, but I might be wrong.)

20 Dec 2007 Siyi Deng

John, thank you for pointing out the error. I realized that in certain occasions length() is unpredictable. I fixed the bug and updated the file.

20 Dec 2007 John D'Errico

With the bug fixed, this worked nicely in my tests. It was able to find/delete those files in subfolders too.

This should be a useful utility if you move drives between mac and windows systems. Of course, the .DS_store files are not really a problem, but they can confuse others who see them from a non-mac system. And of course, you don't want them included when you zip a directory.

Please login to add a comment or rating.
Updates
20 Dec 2007

bug fix

Tag Activity for this File
Tag Applied By Date/Time
clean Cristina McIntire 24 Feb 2009 12:05:50
mac Cristina McIntire 24 Feb 2009 12:05:50
pollution Cristina McIntire 24 Feb 2009 12:05:50
finderdat Cristina McIntire 24 Feb 2009 12:05:50
ds_store Cristina McIntire 24 Feb 2009 12:05:50

Contact us at files@mathworks.com