LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices



Reply
 
Search this Thread
Old 01-15-2007, 01:36 AM   #1
anindyabhattacharjee
LQ Newbie
 
Registered: Oct 2006
Posts: 14

Rep: Reputation: 0
script for deleting .dat files which > 5 mb from a directory and its subdirectory


hi,

can you tell me how to write a script which will remove all the .DAT files which are greater than 5 MB form a directory and its sub-directory ?

Thanks in advance.............

regards
anindya bhattacharjee
 
Old 01-15-2007, 02:28 AM   #2
b0uncer
Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Umm something like
Code:
find /start/directory -name *.DAT -type f -size +5M -print | xargs /bin/rm -f
might find the files (test it first by only taking in the 'find' part, i.e. don't write '-print' nor anything after it -- if it lists correct files, then use the whole line). That's just off the top of my head, so be aware. Read
Code:
man find
for more instructions.
 
Old 01-16-2007, 12:38 AM   #3
anindyabhattacharjee
LQ Newbie
 
Registered: Oct 2006
Posts: 14

Original Poster
Rep: Reputation: 0
deleting problem solved

hi,

thanks for your reply . after doing some changes in your command , I am now able to delete those files .



thanks&regards
anindya bhattacharjee

Last edited by anindyabhattacharjee; 01-16-2007 at 12:40 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing File Permission in a FTP directory to prevent deleting of files shawnbishop Linux - Software 3 01-10-2006 06:41 AM
Deleting unwanted files from any directory without reading each Karthikeyan Gurusamy Linux - Newbie 3 12-24-2005 02:48 AM
deleting all *.m3u files in a directory+subdir? minm Linux - Newbie 5 10-12-2004 04:31 PM
Deleting Windows Index.dat and other 'spyware' from Linux aweir14150 Linux - General 5 03-04-2004 02:54 PM
Script for deleting files based on date MaverickApollo Linux - General 3 02-03-2004 08:54 PM


All times are GMT -5. The time now is 08:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration