The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script for Deleting Core files on root filesystem rgfirefly24 Shell Programming and Scripting 7 02-11-2008 01:41 PM
ftp selected jpeg files from unix filesystem mhbd UNIX for Dummies Questions & Answers 3 12-12-2007 11:57 PM
Loopback files on a FAT based Filesystem? deckard Filesystems, Disks and Memory 1 01-25-2007 02:24 PM
when I try to run rm on multiple files I have problem to delete files with space umen UNIX for Dummies Questions & Answers 1 09-20-2005 12:20 AM
limit of files in the ufs filesystem witt UNIX for Dummies Questions & Answers 2 06-25-2002 07:02 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-10-2007
Registered User
 

Join Date: Jun 2007
Posts: 1
Stumble this Post!
recurse through filesystem to delete files

howdy all --

I recently trashed my old PC and bought a MacBook. Moving all my files over, I find I've got a zillion instances of stupid Windows files like Thumbs.db and desktop.ini all over the place. I'm looking for a way to delete them all at once (deleting each manually would take forever), and I'm hoping there's an easy way to do it using the Unix terminal built into OSX...

Basically, I'm looking for the "drill down through the file system, find every instance of X, and delete it" command...

...any suggestions are appreciated.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 06-11-2007
Registered User
 

Join Date: Mar 2007
Location: Chennai
Posts: 222
Stumble this Post!
Try this,
Code:
find / \( -name 'Thumbs.db' -o -name  'desktop.ini' \) -okay rm {} \;
Above command asks for confirmation before proceeding with rm.

To remove without any confirmation, use
Code:
find / \( -name 'Thumbs.db' -o -name  'desktop.ini' \) -exec /bin/rm {} \;

Thanks.
Nagarajan G
Reply With Quote
  #3 (permalink)  
Old 06-11-2007
solfreak's Avatar
Registered User
 

Join Date: Jun 2007
Posts: 35
Stumble this Post!
Using xargs will be faster:

find / -name Thumbs.db -o -name desktop.ini | xargs rm -f
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:22 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0