Delete Files By Size Recursively

free web hosting
Free Web Hosting > Computers & Tech > Programming > Scripting

Delete Files By Size Recursively

saneax
This is something I had always wated to do, but was afraid of the find's complexity.. here is a very short description, of how I did it.. My linux box.. running squid had no space.. then I relaized.. that squid had those millions of cache files.. deleting them one by one was real pain.. so had to read the 'man find' and here is the result.. it got back 70% of my space..

find /var/spool/squid/* -size +10k -type f -exec rm -f '{}' \;

The command meaning..
find
args1 = <where to find>
args2 = <find by what, which means it could be -name, -type and here we give -size to mean we wish to find files by size>
args3 = <what size.. +10k would mean above 10 kilo bytes>
args4 = <and one more condition .. -type, which means what type of things should it match>
args5 = <-f means files.. we could have mentioned -d (directory) -b (block), -c (character), -f (regular file), -l (link), -s (socket), -p (pipes) >
args6 = <-exec means what action to perform if all the matches are true, so -exec is for action..>
args7..10 = < the following of -exec is a shell command.. rm -f {} \; this means the results of match is removed (deleted)>

Cheers...

 

 

 


Reply

iGuest
Dear All,

After moving the .Xls file I want delete that file.
Am trying this its moving .Xls file, but its not deleted.

I develop this code in corejava. Outside my project its deleted but in my project its not deleted.

Can you please tell me what is the reason?

-sreelatha

Reply

yordan
QUOTE(FeedBacker @ Jan 31 2008, 06:17 AM) *
Dear All,

After moving the .Xls file I want delete that file.
Am trying this its moving .Xls file, but its not deleted.

I develop this code in corejava. Outside my project its deleted but in my project its not deleted.

Can you please tell me what is the reason?

-sreelatha

You should be more explicit. You answer to saneax's post, which trick works correctly provided that you are on a Unix or on a Linux system. The "rm" mentionned commands definitively removes the file, so it could lead to unwanted restults but that's another story.
Now, let's come to your problem, explain slightly more what you are doing. The "xls file" seems to be an indication that you are working on Excel files, probably with a MS-Windows system ? And what are you really trying to do ? Are you using a shell-script ? Could you show us the most pertinent lines in your scripts ?
Regards
Yordan

 

 

 


Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. delete files script size less than - 7.54 hr back. (1)
  2. vb.net recursive file deleter - 8.25 hr back. (1)
  3. delete unix files by size - 8.69 hr back. (2)
  4. "c " recursively delete file - 11.68 hr back. (1)
  5. getting folder size using shell programming in c# - 17.95 hr back. (1)
  6. batch file to delete files greater than a certain size - 34.67 hr back. (1)
  7. remove files with condition linux - 59.48 hr back. (1)
  8. vbs delete file size - 74.89 hr back. (1)
  9. linux remove file by size - 79.98 hr back. (1)
  10. remove files by size linux - 81.46 hr back. (1)
  11. linux delete files size - 88.46 hr back. (1)
  12. linux find "-size -" delete - 88.66 hr back. (1)
  13. search files by size vbs - 88.95 hr back. (1)
  14. linux search and delete mp3 fies - 90.60 hr back. (1)
Similar Topics

Keywords : delete, files, size, recursively

  1. Css File Size
    (7)
  2. Playing Two Wav Files Simultaneously In C#
    (4)
    I have reached a dead-end, in trying to code the Audio Engine for the game - Bomber Man . The
    current engine uses the native functions(waveOutOpen, waveOutWrite, etc) declared in Winmm.dll file.
    While this allows me to play two sounds together (the Background music and the sound effects), it
    causes frequent memory corruptions. For instance, it changes the value of an integer variable
    located in a different and unrelated class. I spent hours trying to find out why the value was
    constantly changing. When I disabled all the sounds, the problem didn't occur. I used a mo....
  3. Need Some Help/advice On How To Restore Lost Files
    (5)
    My problem is this. I had a photo loader software installed on my computer. This prog indexed a
    couple of hondred photos I had. Yesterday I uninstalled the prog form my computer without
    considering the posibility that the folder containing my photos would be deleted to which it did. My
    question is this, what if I used system restore? would it restore my photos too? Or would it simply
    restore just the prog files only?....
  4. Need Some Help/advice On Lost Files.
    (8)
    My problem is this. I had a photo loader software installed on my computer. This prog indexed a
    couple of hondred photos I had. Yesterday I uninstalled the prog form my computer without
    considering the posibility that the folder containing my photos would be deleted too, which it did.
    My question is this, what if I used system restore? would it restore my photos too? Or would it
    simply restore just the prog files only? ThnX in advance....
  5. Friends Can't Start The Exe Files I Send :(
    (3)
    I am using visual c++ 2008. and when I send the .exe file that I created to my friend, (from the
    debug folder) he gets an error message when trying to execute it /sad.gif"
    style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> any ideas? when my friend
    tried, he said that he got the following error message: cannot execute .... And lots of PC info.
    When I create these files, I choose win32 console application (something that looks like the cmd
    when executed) please.. I really need to get this thing working Thanks //Feelay....
  6. Magic Quotes And $_files
    (3)
    It recently came upon me that I was designing a website that used file uploads. Of course, PHP was
    my first choice to solve the problem. I'm pro-PHP and anti-ASP. Perl is somewhere in the middle.
    But anyway! I have magic_quotes_runtime and magic_quotes_gpc both on and it seems to be causing
    some problems with file uploads. If a user uploads a file called "Jared's Stuff.txt" (that was
    one of my tests) then magic_quotes insert a backslash before the apostrophe and $_FILES
    becomes "'s Stuff.txt" since the backslash is interpreted as part of the path....
  7. How To Create/edit/delete Ftp Accounts With Php
    Help me to create one php page to create FTP user accounts in Unix Ser (1)
    Thanks /cool.gif" style="vertical-align:middle" emoid="B)" border="0" alt="cool.gif" /> ....
  8. Uploading More Than 30 Files In Less Than 10 Clicks?
    (5)
    Hey! is it possible to upload lots of files fast, and to a specefic folder? I am sure you guys
    are going to tell me "use" the FTP tool.. But I have no idea how to use it =/....
  9. Software To Concatenate Mp3 Files
    (8)
    Has anyone had good results with mp3 concatenating software? Any recommendations would be useful.
    Thanks.....
  10. If You Have Some Private Files
    (17)
    Hello everyone , Here in this post I will show you how to hide your private files and folders If
    you have some private files and want to prevent others from seeing them you can follow these steps
    to hide these private files First Step Create New Folder any where and rename it hold Alt key
    and press 255 Now you will notice the folder has no name Second Step Now right click this folder
    and select Properties then Customise then change icon and select invisiable icon for this folder you
    will find 4 empty area icons all are fine Third Step Now move all your private ....
  11. Deleting A Corrupt File
    Cannot delete a corrupt file on Windows XP... (25)
    I was upgrading some software and came across a corrupt file that halted the installation process. I
    went to see what was wrong with the file, and failed to manually delete it. I tried moving
    (cut&paste) it to another location, and the installation succeeded. However, the file is still on my
    drive, taking up a KB of space. I know that's not a lot, but where am I supposed to put it? In a
    folder created especially for all the corrupt files on my computer? /blink.gif"
    style="vertical-align:middle" emoid=":blink:" border="0" alt="blink.gif" /> I've heard
    something....
  12. Creating Executable Jar Files
    (9)
    Dear Friends Today I will show you how to create an executable jar file. I do not know whether this
    topic is introduced by any other member. Using this method one can build graphical user interface
    program with java which will behave similar to Executable files i.e., the program can be started
    with double clicks. It is an easy alternative. Otherwise to run a java program one has to run it
    through comand prompt(in windows) using java command or by creating java executalbes which are very
    difficult to make. So lets begin: Frist of all, we will....
  13. Problem Deleting Empty Folder In Win XP
    why you can not delete an empty folder? (13)
    It happened to me several times. When a folder is already empty, but still can't delete it.
    Which says something about other user is using it. Yet I am the only user on my PC. Anyone knows why
    is it? And how to deal with it?....
  14. How To Embed Swf Files In Joomla ?
    (9)
    I want to embed some swf game files into my Joomla project, I've been at it for two hours and
    haven't made much progress. I've tried making a new content item and placing ... but that
    hasn't worked. I'm kind of stuck /sad.gif" style="vertical-align:middle" emoid=":("
    border="0" alt="sad.gif" /> Anyone familiar with Joomla or Mambo that may have some knowledge
    regarding my issue?....
  15. Get User Input From Vbscript For Batch Files
    Get user input from vbscript (2)
    Hello, I didn't see a tutorial on this subject so i'll go ahead and do it. Long ago I used
    batch file programming a quite a bit. I used vbscript files to get user input for the batch files.
    So here is a simple example of using the 'call' command to call for the vbscript file which
    should be in the same folder as the .bat file. in the batch file pretty much anywhere you can start
    the vbscript, and call another .bat file- using @ to of course not echo the line of code - CODE
    @ start /w wscript.exe userin.vbs @ call ~anyname.bat @ del ~anyname.bat....
  16. Renaming Files (Using Excel Spreadsheet)
    (20)
    Hi, I want to use filenames on my Excel Spreadsheet for the files I have in my folder. For example,
    let's say I have these in a folder: Reportdummy.doc Charts102.xls DecemberGraphs.xls
    TestScrap.txt etc... And I have this in my Excel spreadsheet: Report1.doc Charts.xls Graphs.xls
    Scrap.txt etc... Is there an easy way for me to copy the cell's value to the file in that
    folder? I want them to be copied exactly in that order. So far I have to do this manually (copy
    from Excel, then rename and paste for each file). Thanks.....
  17. Switch Network Settings With Batch Files
    A quick way to change IP, Gateway, DNS (18)
    Let's suppose you are using two network settings with your laptop frequently. Wether it's a
    wireless or wired network, all the same: Every time you want to change the IP, subnet mask, default
    gateway and DNS Server(s) of your network connection in any flavour of Windows, you have to click
    through menus, submenus, and from that you go to yet another submenu... you have been there,
    it's awful. /mad.gif' border='0' style='vertical-align:middle' alt='mad.gif' /> There is a
    better way: the command "netsh" on your command prompt can change all the aforementio....
  18. Help Me: Need To Transfer Files From Old Computer
    (18)
    How to I upload my computer stuff. I bought a new computer - a Dell. But I need to get all my files
    form my old computer, and Emachines, can someone help me?....
  19. How Do I Chmod Files On Astahost ?
    (20)
    Hey, how do i CHMOD certain files, i need to CHMOD some files to 0777 but i dont know how :-\ i
    use ws_ftp as my ftp client i also have flash fxp....
  20. How To Play *.rm Files With Media Player
    (13)
    How to play Real audio and video files (*.rm) with Windows Media player!? /blink.gif'
    border='0' style='vertical-align:middle' alt='blink.gif' /> Because of competition between
    Microsoft and Real Networks, Windows Media Player does not support Real audio and video files, and
    real networks does not release any patch for WMP. But, Real has released a patch for other media
    players. Now, I want learn you, how you can use this patch to play Real audio and video files. You
    should have Windows Media Player and Real Player: 1- First go to sourceforge.net website and down....
  21. Sharing Files In Windows Xp Home
    I always get an "access denied mesage" (15)
    when trying to access another computer's shared files on my home network i recieve an error
    message " is not accessable. You might not have permission to use this network resource. Contact
    the administrator of this server to find out if you have access permissions. Access denied" anyone
    know why I am getting this message?....
  22. VB.NET: Howto Add And Delete Files
    Just looking for useful code (8)
    I am horrible at dealing with files in VB. I was wondering if anyone could give me some general
    code for a program I'm working on. I need to be able to add to files, display them, and delete
    them. I have use code out of a book, but it never works very well. Any suggestions?....
  23. How Do I Create And Write To Files?
    creating, writing, deleting files (4)
    Hi, Can someone please tell me how to create files and write to them in PHP. I just want to create
    a simple file containing text, and then be able to read it or update it. Thanks Alfie....
  24. How To Transfer Files From One Computer To Another
    (16)
    Hi friends, I have two computers both having windows XP pro operating system and i have
    one LAN cable and i connected both computers through LAN terminals and i'm unable to transfer
    data from both computers.So what setting i have to make for doing this? Thanks, sunny....
  25. Network Places: Alternative To Ftp On Windows
    Drag and drop files easily to your accnt (10)
    Windows has a feature called "Network Places". This can be used for uploading stuff for your site
    eliminating the need for any ftp client. Here's how we do it. 1.Goto Network Places-> Add a new
    networkplace. 2. Click next-> Choose another network Location->Next. 3. Now type the following
    wothout quotes "ftp://ftp.yoursubdomain.astahost.com". Click next 4. Uncheck log on anonymously and
    type in ur cPanel username. 5. Type any name and click Next->Finish. 6. Now open the folder created
    -> Type in your password Congratulations!! You can now upload your files i....
  26. Monitor Size
    (22)
    I wondering what the average monitor sizes is? Also does anyone know how to code your html, so that
    it causes a website to grow or shrink to fit into the screen? Thanks -------------------------
    This isn't a tutorial acticle at all - and on top of that posted in: Free Web Hosting >
    Computers & Tech > How-To's and Tutorials > Programming > HTML, XML and other Markup Languages
    ??? May I know how these two are related ?? Anyways, moved to Hardware section.. m^e....
  27. How To Hide Your Files In XP
    hide doc and folders (18)
    In this tutorial i will show ou how to hide your documents or folders, but you have to remember
    where it is! ok lets go! pick a file you want to hide from windows XP, to help you i will
    hide a file "hidden.doc" in "C:" open command prompt: START>RUN>CMD you might find yourself in
    your user directory. in the command prompt go into the directory of where your file is going to be
    hidden. as my "hidden.doc" is in "C:" i will use "cd.." command to "change directory before" till
    i get into my C: drive once your there use the attributes command on the file you ar....
  28. Converting Flash Files To Gif
    how to convert flash files to anim gif (7)
    i used swishmax to make simple flash animation. but then, i figured out for simple animations we
    should use gif instead. this is to ensure wider compatibility with older browser or those who didnot
    have flash installed (for security reasons, etc). so, anyone have a simple solution of coverting SWF
    files to GIF files without compromising its quality?. thanks....
  29. What is the size of you HD
    (122)
    What is the size of your HD(s) i got 2.. 1 40GB 1 45GB.. /wink.gif' border='0'
    style='vertical-align:middle' alt='wink.gif' /> ....
  30. Renaming collection of Pictures (files)!
    (15)
    Renaming collection of Pictures (files)! 1- first select your pictures 2- right click on first
    picture and select rename 3- type your name 4- press Shift and click on the free space between
    first and second Picture 5- see result !....

    1. Looking for delete, files, size, recursively

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for delete, files, size, recursively
Similar
Css File Size
Playing Two Wav Files Simultaneously In C#
Need Some Help/advice On How To Restore Lost Files
Need Some Help/advice On Lost Files.
Friends Can't Start The Exe Files I Send :(
Magic Quotes And $_files
How To Create/edit/delete Ftp Accounts With Php - Help me to create one php page to create FTP user accounts in Unix Ser
Uploading More Than 30 Files In Less Than 10 Clicks?
Software To Concatenate Mp3 Files
If You Have Some Private Files
Deleting A Corrupt File - Cannot delete a corrupt file on Windows XP...
Creating Executable Jar Files
Problem Deleting Empty Folder In Win XP - why you can not delete an empty folder?
How To Embed Swf Files In Joomla ?
Get User Input From Vbscript For Batch Files - Get user input from vbscript
Renaming Files (Using Excel Spreadsheet)
Switch Network Settings With Batch Files - A quick way to change IP, Gateway, DNS
Help Me: Need To Transfer Files From Old Computer
How Do I Chmod Files On Astahost ?
How To Play *.rm Files With Media Player
Sharing Files In Windows Xp Home - I always get an "access denied mesage"
VB.NET: Howto Add And Delete Files - Just looking for useful code
How Do I Create And Write To Files? - creating, writing, deleting files
How To Transfer Files From One Computer To Another
Network Places: Alternative To Ftp On Windows - Drag and drop files easily to your accnt
Monitor Size
How To Hide Your Files In XP - hide doc and folders
Converting Flash Files To Gif - how to convert flash files to anim gif
What is the size of you HD
Renaming collection of Pictures (files)!
advertisement




Delete Files By Size Recursively



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE