|
|
|
|
![]() ![]() |
Jan 25 2007, 11:11 AM
Post
#1
|
|
|
Member [ Level 2 ] 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... |
|
|
|
Jan 31 2008, 05:17 AM
Post
#2
|
|
|
Newbie [ Level 1 ] 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 |
|
|
|
Feb 1 2008, 10:14 AM
Post
#3
|
|
|
Way Out Of Control - You need a life :) Group: [MODERATOR] Posts: 1,885 Joined: 16-August 05 Member No.: 7,896 |
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 |
|
|
|
![]() ![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 4th July 2008 - 03:14 AM |