Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Delete Files By Size Recursively
saneax
post Jan 25 2007, 11:11 AM
Post #1


Member [ Level 2 ]
Group Icon

Group: Members
Posts: 72
Joined: 1-September 05
Member No.: 8,237



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...
Go to the top of the page
 
+Quote Post
Feedbacker
post Jan 31 2008, 05:17 AM
Post #2


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869



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
Go to the top of the page
 
+Quote Post
yordan
post Feb 1 2008, 10:14 AM
Post #3


Way Out Of Control - You need a life :)
Group Icon

Group: [MODERATOR]
Posts: 1,885
Joined: 16-August 05
Member No.: 7,896



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
Go to the top of the page
 
+Quote Post

Fast ReplyReply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. What is the size of you HD(122)
  2. Converting Flash Files To Gif(6)
  3. Batch Files(20)
  4. How To Hide Your Files In XP(17)
  5. Monitor Size(22)
  6. Network Places: Alternative To Ftp On Windows(10)
  7. How To Transfer Files From One Computer To Another(13)
  8. How Do I Create And Write To Files?(4)
  9. VB.NET: Howto Add And Delete Files(8)
  10. Php : Variables Included Dont Work In Functions(4)
  11. How To Play *.rm Files With Media Player(11)
  12. Help Me: Need To Transfer Files From Old Computer(18)
  13. Switch Network Settings With Batch Files(16)
  14. Renaming Files (Using Excel Spreadsheet)(19)
  15. Get User Input From Vbscript For Batch Files(1)
  1. Problem Deleting Empty Folder In Win XP(13)
  2. Creating Executable Jar Files(6)
  3. Deleting A Corrupt File(24)
  4. Is It A Good Practice To Store Image Or Other Binary Files Directly In A Mysql Database(4)
  5. My Bitdefender Doesnt Delete All Viruses And Trojans(3)
  6. Software To Concatenate Mp3 Files(8)
  7. Uploading More Than 30 Files In Less Than 10 Clicks?(5)
  8. How To Protect Included Files(10)
  9. How To Create/edit/delete Ftp Accounts With Php(1)
  10. Magic Quotes And $_files(3)
  11. Friends Can't Start The Exe Files I Send :((3)
  12. Need Some Help/advice On Lost Files.(8)
  13. Need Some Help/advice On How To Restore Lost Files(3)


 



- Lo-Fi Version Time is now: 4th July 2008 - 03:14 AM