Find and delete .DS_Store files

I have a 2008 server where some mac clients connect. They create .DS_Store, ._.TemporaryItems and other files that starts with "._".
I want to find them and delete them every night.
What kind of script can I run.
Thank you so much for your help.

I know this is an old thread, I just came across this problem myself when I was moving my files back to PC from Mac.  Here is the approach I took:
# Check to see what files are in the directory, you may want to save this to a variable or CS
ls -Recurse
-force |
Where-Object {$_.Name
-like "._*"}
| Select
Name, Directory,
Length
# See how many files exist that meet the criteria
ls
-Recurse
-force |
Where-Object {$_.Name
-like "._*"}
| Measure-Object
# Use the -Force switch to get past the permissions restrictions on the hidden files
ls
-Recurse
-force |
Where-Object {$_.Name
-like "._*"}
| Remove-Item
-Force
# Rinse and repeat for the .DS Store files
ls -Recurse
-force |
Where-Object {$_.Name
-like ".DS*"}
| Measure-Object
ls -Recurse
-force |
Where-Object {$_.Name
-like ".DS*"}
| Remove-Item
-Force

Similar Messages

  • Find and delete duplicate files on my macbook pro?

    How can I find and delete duplicate files on my macbook pro. Just that i have so many and i think it is wasting a lot of memory etc on my mac! is there a simple and easy way to do so. Like i know in itunes you can just go to one of the opitions and show duplicates, is there anything like that with finder for my whole macbook?
    Thanks in advance!:)

    Decloner will compare the files themselves, not just by name or size.
    For the latest version and faster updates, also to give the developer a extra 30%, choose the developers site version, simply hold control or option key to temporarily turn off Mountain Lion's annoying Gatekeeper to run the app.
    http://www.pixelespressoapps.com/decloner/

  • How can I find and delete duplicate files in Mt Lion?

    As a competent, but self-trained mac user for 30 years, I'm totally baffled by the sudden appearance of multiple duplicate documents and .jpgs in my imac files. How can I find and delete them?

    Duplicate Annihalitor - http://brattoo.com/propaganda/ - or Decloner - http://www.pixelespressoapps.com/decloner/
    LN

  • Finding and deleting duplicate files

    I apologize in advance if I didn't search effectively enough, but having found no discussion of my problem, here it is:
    Is there a way to find, select and delete duplicate files on my hard drive? I know they exist, and would like to see them listed so I can delete This would be text, photo and movie files. Thanks in advance.
    Peace,
    SredniVashtar
    P.S. I'm using ilife 08 which has produced a lot of occult duplicate clip files. If anyone knows why mac eliminated the "create a still frame" option, I'd love to hear it...

    Go to http://macupdate.com/ and search "duplicates". There are some different utilities for photos, movies and tunes. Although Spring Cleaning will do all, I would stay away from that one or be VERY careful what you delete. Make sure they are only user files in your Home, not system files or Library files.
    -mj
    [email protected]

  • How to Find and delete Duplicated Files

    When i bought my iMac 18 months ago, most of the files from my old G5 where transfer in this iMac.
    Also, at this time, the G5 was connect in target mode to the iMac and I was copying files to my iMac when ever a files was needed.
    I now realise I have lots of duplicted files.
    How can I find and delete all thosew duplicates items? Is there a fast solution? Automator?
    How about mail import, I also have lots of duplicate email. Is there a solution to all this?
    Than you for your help.
    BigBlaze

    You can find programs to do what you want by going to Google and post the same question you did on here.  One I noticed was GEMINI by MacPaw.  Good Luck.

  • How do i find and delete duplicate files

    I know that I have many duplicate downloads (particularly Adobe Reader Files) that I would like to trash.
    Is there an easier way to find duplicates other than opening them all and comparing them?

    In unix you can use a combination of ls and diff.
    Unfortunately Apple is notorious for creating crippleware, so they have only provided this function in iPhoto and maybe iTunes.  There is no easy Finder solution, such as would make sense as part of Smart Folders!
    Stupid Apple 

  • How do I find and delete duplicate files safely?

    In looking in "all files", I see that I have several duplicate of files; sometimes two, sometimes three of the same file. I somehow did this when transferring my files to this new Mac, but never the less, I would like to clean this up. Is there an app that would safely do this? There must be a better way than just looking through and cleaning this up manually....Please help, and thank you in advance!

    I can't recommend an application, but suggest you avoid applications like CleanMyMac, MacKeeper, and other cleaning programs. They usually cause more harm than good.
    EasyFind works pretty well at finding files.
    EasyFind – Spotlight Replacement

  • How to find and delete duplicate files?

    Is it possible to have duplicate programs too.  I think I downloaded Picassa two times.  If so how do I delete them?
    thanks,

    Search with spotlight (command-option-space) then select the result and press command-r and it will take you to the file location.

  • How do I find and delete invisible files?

    Mac Hard Drive info window says 157.58 GB used and 159.56 GB capacity, leaving 1.99 available. 
    Total for all folders in Mac HD is 133.344 GB.
    14.13 GB  Library
    04.81 GB System
    114.4 GB Users
    16.58  GB Applications
    .004   GB  User Guides and Info
    I appear to missing about 20 GB storage that I desperately need.
    What is going on?
    How do I clear out "invisible file" if that's what's taking up the 20 gigs?
    How do I prevent this from happening again?
    Please advise.
    Thank you. 
    I have a MBPRO 2.26 running OSX 10.6.8

    Thanks so much  for your response.
    Do you have any idea why there are 20 GB unaccounted for?
    My hard drive seems to fill itself up continouously...I'd like to figure that one out.
    Yes...Getting a larger HD is a great idea.
    Does having a large HD impair performance?
    I am thinking about getting a 1.5 TB Seagate Barracuda.
    http://www.amazon.com/Seagate-Barracuda-3-5-Inch-Internal-ST1500DM003/dp/B005T3G RPU/ref=aag_m_pw_dp?ie=UTF8&m=AVCN3MVCVULPH

  • HT201250 How do I find and delete local backups.  This is taking up over 200g of space on my MBP

    I recently looked at my hard disc drive and backups were taking over 200gb of space.  I used the terminal command to stop taking local backups, but when I rechecked disc space it only moved the space from backup to other. 
    Is there a way to find and delete this files?  Then I can start fresh with Time Machine.
    Thanksm
    Tp

    You don't need to delete local snapshots. They're delete automatically when free space falls below a certain level.

  • Finding and deleting files

    Hi,
    As an Automator newbie, here is what I did to delete all the .DS_Store files under a certain directory:
    1) Find Finder Item:name contains .DS_Store
    2) Move to trash
    I was hoping this will find all the .DS_Store files under a directory and its sub directories and delete them, but turn out nothing was achieved, any idea what I did wrong here? thanks,

    There are free utilities that will remove those files. Look for them at VersionTracker or MacUpdate.
    You are aware that although you may delete them they will simply be re-created by the operating system?

  • I used time machine to restore on a formatted MAC. Now the HDD space has reduced by 100GB but I cannot see any of the files. How do I find and delete those 100GB data from the HDD?

    I used time machine to restore on a formatted MAC. Now the HDD space has reduced by 100GB but I cannot see any of the files. How do I find and delete those 100GB data from the HDD?

    dglenn9000 wrote:
    I created a new user account just to see if it was my user Library or if there was something wrong with my system. And the new user account is doing most of the same things so I will need to do a full restore anyway.
    Not necessarily. I'd suggest downloading and installing the "combo" update. That's a combination (thus the clever name) of all the updates to Leopard since it was first released, so installing it should fix anything that's gone wrong since then, such as with one of the normal "point" updates. Info and download available at: http://support.apple.com/downloads/MacOS_X_10_5_8_ComboUpdate Be sure to do a +Repair Permissions+ via Disk Utility (in your Applications/Utilities folder) afterwards.

  • When I connect my iphone to my itunes it says loads of space is being taken up by documents , however i have no documents saved on my phone to my knowledge. how do I find and delete these hidden files ?

    when I connect my iphone to my itunes it says loads of space is being taken up by documents , however i have no documents saved on my phone to my knowledge. how do I find and delete these hidden files ?

    I restored the phone so had no apps on it at all and there was still this certain amount of space used up by documents ! I've already had it in to the apple store and they didn't seem to have a clue either ! Ugh ! Wouldn't mind so much if the phone was free with a contract but I actually spent 450 quid buying this phone and it's always full of "nothing" so virtually unusable

  • A mysterious audio file opens when I open my browser. How do I find and delete it?

    A mysterious audio file opens when I open my browser. How do I find and delete it?

    The other possibility is that someone with access to your machine (children?, co-worker?) set up all of your browsers to have that audio file set up as a default "home page". This is probably more likely than malware. I just tried with Safari, and it's definitely possible. Check out your Safari preferences and see what it shows as your homepage.

  • HELP!! How can I find and delete duplicate mp3 files.

    I have a zillion copies of songs and I want to find and delete duplicate mp3 files. I have used MediaRage to find the duplicate files (16 thousand or so) but it can't delete them. It will take a million yrs to delete them manually. Does anyone know a way to do this quickly or a program that will do this for me. I have a 15 in Powerbook with OS 10.5.3
    Thanks so much if you can help.

    This site: http://dougscripts.com/itunes/ has hundreds of scripts (small programs that do stuff) for iTunes.
    Bound to be something there for you.

Maybe you are looking for

  • Issue in Creation of shipment with events  using BAPI_SHIPMENT_CREATE

    Hello experts, I am trying to create shipments using BAPI_SHIPMENT_CRETAE for which data is provided in an excel. The issue here is I have to create the events in shipment i.e., I need to fill the Further dates tab. But in this BAPI there is no such

  • Strange CD/DVD drive issues

    i never had a problem with my CD/DVD drive until around a month ago. I was using iDVD to burn a homemade movie for one of my friends and when it finished burning and I pressed eject. the only problem was that it didn't eject. It makes noises like it'

  • Imessages do not appear in conversation only main menu

    When I receive a text message and respond to it, if the sender sends another text, it does not appear in the on-going conversation. The "messages" arrow at the top of the screen (to the left of the sender's name) displays a number to indicate the per

  • Cannot upgrade to OSx Lion no Recovery

    I purchased and tried to install the OSx Lion upgrade. My mac is running Mac OSx 10.6.8 and I have bootcamp with Windows 7 It seems that there is some sort of problem in upgrading the OS when bootcamp is installed, but I am not sure of which would be

  • HT4539 Unable to make purchases from iTunes store

    I am unable to make any purchases from iTunes store. All I get is I have been trying now for over a day. I have logged out from my account. Restarted iMac and done most other things I can think of. Any suggestions please