HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Tidy up of files in a directory
Operating System - HP-UX
1835989
Members
4820
Online
110088
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2001 05:17 AM
02-11-2001 05:17 AM
All,
I am having strange difficulties with the removal of some files.
I am trying to remove all files in a directory older than 120 days (6 months).
I have tried the following commands to no avail: (I have put the full line in quotes so that it would appear on this posting only.
cd /dirname
"find . -atime +120 -exec rm {} \;"
"find . -name "sapconf.*" -atime +120 -exec rm {} \;"
The syntax is correct I believe as it is not returning an error message.
For some reason it is not picking up my file list.
The directory looks like this and as you can see, I have some files that are older than 6 months.
total 3958
-rw-rw-rw- 1 pics users 111 May 27 1999 sapconf.99052764004
-rw-rw-rw- 1 pics users 204 Jun 18 1999 sapconf.99061864239
-rw-rw-rw- 1 pics users 146 Jun 18 1999 sapconf.99061865142
-rw-rw-rw- 1 pics users 527 Jun 21 1999 sapconf.99062135964
-rw-rw-rw- 1 pics users 567 Jun 21 1999 sapconf.99062136333
-rw-rw-rw- 1 pics users 713 Jun 22 1999 sapconf.99062251597
-rw-rw-rw- 1 pics users 5836 Jul 15 1999 sapconf.99071555807
-rw-rw-rw- 1 pics users 8024 Jul 22 1999 sapconf.99072246054
-rw-rw-rw- 1 pics users 2901 Jul 22 1999 sapconf.99072246351
-rw-rw-rw- 1 pics users 4164 Aug 27 1999 sapconf.99082753823
-rw-rw-rw- 1 pics users 2769 Aug 27 1999 sapconf.99082761942
-rw-rw-rw- 1 pics users 2862 Aug 27 1999 sapconf.99082762759
-rw-rw-rw- 1 pics users 220 Sep 16 1999 sapconf.99091641099
-rw-rw-rw- 1 pics users 2106 Nov 2 1999 sapconf.99110239129
-rw-r--r-- 1 root sys 11065 May 23 2000 sapconf.00052371491
-rw-rw-rw- 1 pics users 109 May 24 2000 sapconf.00052041687
-rw-r--r-- 1 root sys 13173 May 24 2000 sapconf.00052470617
-rw-r--r-- 1 root sys 11986 May 25 2000 sapconf.00052570723
-rw-r--r-- 1 root sys 2396 May 26 2000 sapconf.00052670376
-rw-r--r-- 1 root sys 0 May 27 2000 sapconf.00052768578
-rw-r--r-- 1 root sys 0 May 29 2000 sapconf.00052970372
-rw-r--r-- 1 root sys 10856 May 30 2000 sapconf.00053070377
-rw-r--r-- 1 pics users 9568 May 31 2000 sapconf.00052270616
-rw-r--r-- 1 root sys 16731 May 31 2000 sapconf.00053170377
-rw-r--r-- 1 root sys 6931 Jun 1 2000 sapconf.00060170366
#
Suggestions/ideas would be greatly appreciated.
Nickd
I am having strange difficulties with the removal of some files.
I am trying to remove all files in a directory older than 120 days (6 months).
I have tried the following commands to no avail: (I have put the full line in quotes so that it would appear on this posting only.
cd /dirname
"find . -atime +120 -exec rm {} \;"
"find . -name "sapconf.*" -atime +120 -exec rm {} \;"
The syntax is correct I believe as it is not returning an error message.
For some reason it is not picking up my file list.
The directory looks like this and as you can see, I have some files that are older than 6 months.
total 3958
-rw-rw-rw- 1 pics users 111 May 27 1999 sapconf.99052764004
-rw-rw-rw- 1 pics users 204 Jun 18 1999 sapconf.99061864239
-rw-rw-rw- 1 pics users 146 Jun 18 1999 sapconf.99061865142
-rw-rw-rw- 1 pics users 527 Jun 21 1999 sapconf.99062135964
-rw-rw-rw- 1 pics users 567 Jun 21 1999 sapconf.99062136333
-rw-rw-rw- 1 pics users 713 Jun 22 1999 sapconf.99062251597
-rw-rw-rw- 1 pics users 5836 Jul 15 1999 sapconf.99071555807
-rw-rw-rw- 1 pics users 8024 Jul 22 1999 sapconf.99072246054
-rw-rw-rw- 1 pics users 2901 Jul 22 1999 sapconf.99072246351
-rw-rw-rw- 1 pics users 4164 Aug 27 1999 sapconf.99082753823
-rw-rw-rw- 1 pics users 2769 Aug 27 1999 sapconf.99082761942
-rw-rw-rw- 1 pics users 2862 Aug 27 1999 sapconf.99082762759
-rw-rw-rw- 1 pics users 220 Sep 16 1999 sapconf.99091641099
-rw-rw-rw- 1 pics users 2106 Nov 2 1999 sapconf.99110239129
-rw-r--r-- 1 root sys 11065 May 23 2000 sapconf.00052371491
-rw-rw-rw- 1 pics users 109 May 24 2000 sapconf.00052041687
-rw-r--r-- 1 root sys 13173 May 24 2000 sapconf.00052470617
-rw-r--r-- 1 root sys 11986 May 25 2000 sapconf.00052570723
-rw-r--r-- 1 root sys 2396 May 26 2000 sapconf.00052670376
-rw-r--r-- 1 root sys 0 May 27 2000 sapconf.00052768578
-rw-r--r-- 1 root sys 0 May 29 2000 sapconf.00052970372
-rw-r--r-- 1 root sys 10856 May 30 2000 sapconf.00053070377
-rw-r--r-- 1 pics users 9568 May 31 2000 sapconf.00052270616
-rw-r--r-- 1 root sys 16731 May 31 2000 sapconf.00053170377
-rw-r--r-- 1 root sys 6931 Jun 1 2000 sapconf.00060170366
#
Suggestions/ideas would be greatly appreciated.
Nickd
Always learning
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2001 05:46 AM
02-11-2001 05:46 AM
Re: Tidy up of files in a directory
Don't quote me on this (haven't got man pages to hand) but shouldn'y you be using -mtime rather than -atime?
I am an HPE Employee
I am an HPE Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2001 07:59 AM
02-11-2001 07:59 AM
Solution
Nick:
Duncan is indeed correct. If you want to find files based on modification date, use 'mtime'. For searches based on last-access date, use 'atime'. For searches based on the last inode change (permissions modified, file moved, etc.) use 'ctime'. For the 'n' argument. '+n' means more than 'n', '-n' means less than 'n', and 'n' means exactly 'n'.
Thus, in your case, you looked for files that were not accessed during the last 120-days.
...JRF...
Duncan is indeed correct. If you want to find files based on modification date, use 'mtime'. For searches based on last-access date, use 'atime'. For searches based on the last inode change (permissions modified, file moved, etc.) use 'ctime'. For the 'n' argument. '+n' means more than 'n', '-n' means less than 'n', and 'n' means exactly 'n'.
Thus, in your case, you looked for files that were not accessed during the last 120-days.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2001 01:32 AM
02-12-2001 01:32 AM
Re: Tidy up of files in a directory
Thank you to both of you.
This forum is extremely helpful to people like me who work at a company where there is no other Unix Knowledgable people. Not even the 25% that I know ;-)
Sometimes, you can not see the trees for the forest.
Thanks again.
This forum is extremely helpful to people like me who work at a company where there is no other Unix Knowledgable people. Not even the 25% that I know ;-)
Sometimes, you can not see the trees for the forest.
Thanks again.
Always learning
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP