- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Finding files
Categories
Company
Local Language
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
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
Community
Resources
Forums
Blogs
- 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
05-01-2008 01:42 AM
05-01-2008 01:42 AM
If I want to find the files which are modified (or created) 6 hours ago which option I can use along with find cmd.
OS: HPUX 11.23
In Linux, there is an option mmin, that works fine. This is not working in HPUX.
Do you have any solution?
regards
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2008 02:00 AM
05-01-2008 02:00 AM
Re: Finding files
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1227469
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2008 02:09 AM
05-01-2008 02:09 AM
Re: Finding files
You can play with the touch command.
Create a file with time stamp 6 hours before current time :
touch -t YYMMDDhhmm /tmp/stamp
and run find / -newer /tmp/stamp
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2008 02:46 AM
05-01-2008 02:46 AM
Re: Finding files
You can use the sample perl scriptd to find your criteria
perl -MFile::Find -le 'find(sub{print $File::Find::name if -f $_ && -M _ <= 6/24},@ARGV)' /path
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2008 03:12 AM
05-01-2008 03:12 AM
Re: Finding files
I'll give you a better picture of my problem.
I'm exporting the oracle DB every two hours. I want to keep only the last two or three backups,rest of the files should be removed. I'm using a script to automate this process, in witch I'm using mtime option to find the files. So, system keeps 12 copies of backup files and rest of the files are removed.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2008 03:54 AM
05-01-2008 03:54 AM
SolutionYou could use something like below:
find /path -exec ls -lrt {} +|head -3|xargs -i ls {}
If you have 12 files left while running the script and you want to keep 3 files from that then you have to change the head -3 to head -9
find /path -exec ls -lrt {} +|head -3|xargs -i rm {}
Just fine tune your current script using head command. Try with ls first and once you are satisfied replace it with rm.
You can also play with ls -lt and tail instead of ls-lrt and head.
Regards,
Rasheed Tamton.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2008 06:25 AM
05-01-2008 06:25 AM
Re: Finding files
> works fine. This is not working in HPUX.
It might work if you used GNU "find".
http://www.gnu.org/software/findutils/
You need something better than the PA-RISC
bundled C compiler to build it, but GCC can
do it, or you could probably find a pre-built
depot in the usual places.
dy # gfind --version
GNU find version 4.2.33
Built using GNU gnulib version 8e128ebf42e16c8631f971a68f188c30962818be
Features enabled: O_NOFOLLOW(enabled) LEAF_OPTIMISATION
dy # gfind . -mmin 5
./lib
./lib/regexprops
dy # uname -a
HP-UX dy B.11.11 U 9000/785 2012616114 unlimited-user license
The same holds true for most Linux tools,
which are, in fact, GNU tools (running on
GNU/Linux).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2008 08:41 AM
05-01-2008 08:41 AM
Re: Finding files
If you want to delete all, except two (or three) backups, you can run the following in the directory where your exports are located:
ls -1t export* | awk 'NR>2 {system("rm " $1)}'
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2008 02:30 AM
05-02-2008 02:30 AM
Re: Finding files
I got the solution from Mr.Rasheed's suggestion. I implemented the same.
Once again, Thank you very much.
with best regards