LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Scripts to delete certain files sizes (https://www.linuxquestions.org/questions/linux-newbie-8/scripts-to-delete-certain-files-sizes-4175500321/)

mahan77 04-02-2014 10:01 AM

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

luisfpetrucci 04-02-2014 11:03 AM

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.

TB0ne 04-02-2014 04:25 PM

Quote:

Originally Posted by mahan77 (Post 5145348)
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.

mahan77 04-02-2014 05:44 PM

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


All times are GMT -5. The time now is 06:55 AM.