Solved

find and remove old files (include 2G and up sizes)

Posted on 2002-05-28
7
525 Views
Last Modified: 2013-11-18
our old command :
find . -mtime +1 -exec rm -rf {} \;
doesn't work with files larger>2GB under RedHat Linux 7.1

example :
13:34{320}lnx16:tmp_dumps> ls -lR
...
...
-rw-r--r--    1 yanivb   ftp      3973090008 May 26 15:44 ncsim.trn

But with find on the same location :

We can see that find gives files < 2GB :


13:34{315}lnx16:fox> find . -mtime +1 -exec ls -l {} \;
total 1969300
-rw-r--r--    1 evgeny   ftp      17220328 May 26 13:05 ncsim.dsn
-rw-r--r--    1 evgeny   ftp      1997353600 May 26 13:05 ncsim.trn
-rw-r--r--    1 evgeny   ftp      17220328 May 26 13:05 ./ncsim.shm.2_6_3.evgeny.26May/ncsim.dsn
-rw-r--r--    1 evgeny   ftp      1997353600 May 26 13:05 ./ncsim.shm.2_6_3.evgeny.26May/ncsim.trn

the problem : how to remove them all , regardless size ???
0
Comment
Question by:Talmash
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7039300
probably your RH cannot handle files ith size > 2GB, this is a kernel limitation.
To remove such files you either need a kernel with large-file support (AFAIK 2.4.x), or use debugfs for these files.
0
 
LVL 6

Author Comment

by:Talmash
ID: 7041124
my old dear friend hoffmann !

what is debugfs ?

FYI , this question I forward to our company's system admin. ,
I suggested to him , to solve our problem using a script :

1) ls -lR > list
2) foreach i (list)
          look for files older then 24 hours and remove them .
(the filtering will using a script to read the Month and Day from the ls -l output , example :

ls -l :
-rw-r--r--   1 talm        38912 Apr 15 13:39 HotInit_LinkList_2k.txt
file date = num(Apr)+(15)/100 = 4.15
date = num(May)+(29)/100 = 5.29
if (date - file_date > 0.01)
     rm file

(this script got problem with January/December can be solved with seperated IF condition (file_date > 12 && data < file_date && date < 2)

0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 100 total points
ID: 7041244
> what is debugfs ?
following stolen from  man debugfs:

NAME
   debugfs - ext2 file system debugger

SYNOPSIS
   debugfs [-f cmd_file] [-R request] [-V] [-w [device]]

DESCRIPTION
   The debugfs program is a file system debugger. It can be
   used to examine and change the state of an ext2 file system.
   device is the special file  corresponding to the device
   containing the ext2 file system (e.g /dev/hdXX).
...


Waht has you "check file date" script to do with the 2GB file problem?
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 6

Author Comment

by:Talmash
ID: 7041309
tnx hof ,

the script will "find" files older then 24 hours using the ls -l , NOT using the 'find' command .

the script will decide how old is the file up to the Month/Day (from ls -l) and rm it .

I forwarded your comment to our sys.admin.

waiting for a response from him .

tal
0
 
LVL 21

Expert Comment

by:tfewster
ID: 7921246
No comment has been added lately, so it's time to clean up this Topic Area.
I will leave a recommendation for this question in the Cleanup topic area as follows:

- PAQ & refund points

Please leave any comments here within the next 7 days

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

tfewster
Cleanup Volunteer
0
 
LVL 6

Author Comment

by:Talmash
ID: 7923590
since I know you long time ,
and since u r the only respondant ,

get my points , although I was aaking to a script .

from time to time , I meet such problems .
some I solve by myself , and some I forward to other hope
he will solve .

I wished to get the solution from you .

anyway , this specific case , my idea was found good to our sysadmin , and he changed the auto-script to replace 'find' with smarter search .

Tal
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7924163
hmm, didn't recognize the "script request", sorry. But AFAIK debugfs cannot be scripted, you need expect for that.
Thanks anyway for cleaning up this qeustion.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question