LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-02-2014, 11:01 AM   #1
mahan77
LQ Newbie
 
Registered: Apr 2013
Location: London
Distribution: centos
Posts: 14

Rep: Reputation: Disabled
Scripts to delete certain files sizes


Hi,

This file generated by asterisk recording. Now I need a script to delete the file under 4.0K sizes, so I can run the scripts in asterisk dial plan. Below the size of 4.0K are unwanted files.

4.0K 3001-02-04-2014-00:01-FROM-3002.wav
4.0K 3001-02-04-2014-15:39-FROM-3003.wav
4.0K 3002-02-04-2014-13:52-FROM-3003.wav
4.0K 3002-02-04-2014-13:53-FROM-3003.wav
4.0K 3002-02-04-2014-14:04-FROM-3003.wav
4.0K 3002-02-04-2014-14:52-FROM-3003.wav
4.0K 3002-02-04-2014-15:23-FROM-3003.wav

Many thanks
Sathees

Last edited by mahan77; 04-02-2014 at 11:05 AM. Reason: wrong heading
 
Old 04-02-2014, 12:03 PM   #2
luisfpetrucci
LQ Newbie
 
Registered: Mar 2014
Location: Colombia
Distribution: Fedora
Posts: 11

Rep: Reputation: Disabled
Hi, the find program has a -size option and --delete too, see his man page you can make a search with find and delete all files of determined size.

Last edited by luisfpetrucci; 04-02-2014 at 12:04 PM.
 
2 members found this post helpful.
Old 04-02-2014, 05:25 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,949

Rep: Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693
Quote:
Originally Posted by mahan77 View Post
Hi,
This file generated by asterisk recording. Now I need a script to delete the file under 4.0K sizes, so I can run the scripts in asterisk dial plan. Below the size of 4.0K are unwanted files.

4.0K 3001-02-04-2014-00:01-FROM-3002.wav
4.0K 3001-02-04-2014-15:39-FROM-3003.wav
4.0K 3002-02-04-2014-13:52-FROM-3003.wav
4.0K 3002-02-04-2014-13:53-FROM-3003.wav
4.0K 3002-02-04-2014-14:04-FROM-3003.wav
4.0K 3002-02-04-2014-14:52-FROM-3003.wav
4.0K 3002-02-04-2014-15:23-FROM-3003.wav

Many thanks
Sathees
You've been registered here for a year now...have none of the other answers about scripting you've been given helped at ALL?
http://www.linuxquestions.org/questi...ts-4175459768/
http://www.linuxquestions.org/questi...es-4175459706/

Do not just post questions, and expect people to write your scripts for you; YOU, actually need to show some effort of your own. Post what you have written/tried, and tell us where you're stuck, and we can help you. Otherwise, look up some of the VERY easily found scripting tutorials, and read the man pages on the Linux command utilities, and start writing your own scripts.
 
1 members found this post helpful.
Old 04-02-2014, 06:44 PM   #4
mahan77
LQ Newbie
 
Registered: Apr 2013
Location: London
Distribution: centos
Posts: 14

Original Poster
Rep: Reputation: Disabled
Thank you for your kind word. After member luisfpetrucci point me to find command, I have managed googleed.
This is the script to remove the file.

Find -size -45k –delete

Yes it has been long, I’m still learning. I hope you will help me as I go along
Many thanks
Sathees
 
  


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
Problem with logrotate and size - rotates every time, no matter what size set mav1c Red Hat 3 08-05-2013 02:30 PM
[SOLVED] xsane reduces size of image of scanned page - how to get back to full size? taylorkh Linux - Software 7 11-12-2010 05:37 PM
Extended a LV size, but df shows orig size, using DEBIAN ETCH, on a AMD64 hector3rd Linux - Newbie 8 04-23-2008 06:36 AM
/proc/kcore size doesn't match with physical ram size cash_05 Linux - Newbie 2 06-01-2005 02:23 PM
Total partition size - User partition size is not equals to Free partition size navaneethanj Linux - General 5 06-14-2004 01:55 PM


All times are GMT -5. The time now is 08:27 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration