LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (https://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   script for deleting .dat files which > 5 mb from a directory and its subdirectory (https://www.linuxquestions.org/questions/linux-enterprise-47/script-for-deleting-dat-files-which-5-mb-from-a-directory-and-its-subdirectory-519368/)

anindyabhattacharjee 01-15-2007 12:36 AM

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

b0uncer 01-15-2007 01:28 AM

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.

anindyabhattacharjee 01-15-2007 11:38 PM

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


All times are GMT -5. The time now is 04:53 AM.