recurse through filesystem to delete files


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers recurse through filesystem to delete files
# 1  
Old 06-11-2007
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.
# 2  
Old 06-11-2007
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
# 3  
Old 06-11-2007
Using xargs will be faster:

find / -name Thumbs.db -o -name desktop.ini | xargs rm -f
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Recurse directories and return random file

I have a nice program to change the background but I want it to operate on subdirectories as well. # Script to randomly set Background from files in a directory while true;do # Directory Containing Pictures DIR="/home/pc/Pictures" # Internal Field Separator set to newline, so file names... (4 Replies)
Discussion started by: triplemaya
4 Replies

2. Shell Programming and Scripting

Script needed to delete to the list of files in a directory based on last created & delete them

Hi My directory structure is as below. dir1, dir2, dir3 I have the list of files to be deleted in the below path as below. /staging/retain_for_2years/Cleanup/log $ ls -lrt total 0 drwxr-xr-x 2 nobody nobody 256 Mar 01 16:15 01-MAR-2015_SPDBS2 drwxr-xr-x 2 root ... (2 Replies)
Discussion started by: prasadn
2 Replies

3. UNIX for Dummies Questions & Answers

Finding Files only under a specific FileSystem

Hi, I am using AIX and one of my file systems is getting filled up and I need to track with files are occupying more volume. Filesystem GB blocks Free %Used Iused %Iused Mounted on /dev/nhdb_lv 2110.00 63.80 97% 76525 1% /nhdb under the Mount Point /nhdb... (1 Reply)
Discussion started by: zulfi123786
1 Replies

4. AIX

Process using/creating files in the filesystem

Hello Team, In a application filesystem, there is a process keep creating the log files. Due to that the filesystem keep getting full. Please let me know how to identify the process which is keep writing in the filesystem. fuser -u <FS> will show only the user who using the filesystem.... (3 Replies)
Discussion started by: gowthamakanthan
3 Replies

5. Red Hat

Unable to write files on a filesystem

hi mounted filesystem is 50% and appropriate permissions were there but im still unable to write files ? (3 Replies)
Discussion started by: rajeshz
3 Replies

6. Shell Programming and Scripting

help with pasting files in filesystem

quick question.. say i have few files in D or E drive.. i want to paste them in Filesystem that is /home/vivek folder... but when i try to do that it shows some error saying "There is not enough space on the destination. Try to remove files to make space." but i think its due to authorization... (3 Replies)
Discussion started by: vivek d r
3 Replies

7. UNIX for Dummies Questions & Answers

hwo to find shared filesystem and local filesystem in AIX

Hi, I wanted to find out that in my database server which filesystems are shared storage and which filesystems are local. Like when I use df -k, it shows "filesystem" and "mounted on" but I want to know which one is shared and which one is local. Please tell me the commands which I can run... (2 Replies)
Discussion started by: kamranjalal
2 Replies

8. AIX

Encryption of files on AIX 5.3 GPFS filesystem

Hi Are there any tools out there that can encrypt files on a GPFS file system which are being accessed by multiple AIX 5.3 nodes? Situation, I need various application servers to read/write files that are on a GPFS share. Therefore the encryption mechanisum need to be transparent to the... (1 Reply)
Discussion started by: maximum
1 Replies

9. Filesystems, Disks and Memory

Loopback files on a FAT based Filesystem?

I'm trying to set up a set of loopback files on a digital music player so I can carry a QEMU virtual machine with me. The digital music player in question is the Rio Karma and the filesystem it uses is omfs. Based on what I read at the Rio Karma FS page:... (1 Reply)
Discussion started by: deckard
1 Replies

10. UNIX for Dummies Questions & Answers

limit of files in the ufs filesystem

Hello ! Does anyone knows which de limit of files in the ufs filesystem in the Solaris 2.6 ?? Danke, Witt (2 Replies)
Discussion started by: witt
2 Replies
Login or Register to Ask a Question