Solved

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

Posted on 2002-05-28
7
515 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Cygwin VIM in WIndows 2007: Unable to copy text to Windows 10 86
Swiper slider stops between pages 11 56
lunix and unix command 21 155
umask commands 5 22
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

710 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