- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to find file newer than another while limi...
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
Discussions
Discussions
Discussions
Forums
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
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
тАО03-19-2007 03:48 AM
тАО03-19-2007 03:48 AM
I need to find all files within a specific directory that contain the extension *.out that are newer than Jan 1, 2007.
To begin, I created a tmp file called jan 1 in the directory using touch witha DTS of jan 1 2007 0001.
Now, I am trying to do my find like this:
find . -newer jan1 -print > /tmp/out '*.out'
but it isn't working....
I get this error
find: missing conjunction
any ideas here?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-19-2007 03:53 AM
тАО03-19-2007 03:53 AM
Solutionfind . -type f -name '*.out' -newer jan1 > /tmp/out
You really should be using /tmp for user temporary files. /tmp is reserved for the OS; use /var/tmp instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-19-2007 03:57 AM
тАО03-19-2007 03:57 AM
Re: How to find file newer than another while limiting the find criteria...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-19-2007 04:02 AM
тАО03-19-2007 04:02 AM
Re: How to find file newer than another while limiting the find criteria...
> This may sound simple but how do i get it to print the apsolute path vice the relative one?
The simplest way is to specify the absolute path instead of the "." (relative path):
# find /path -newer jan1 -name "*.out" > /tmp/out
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-19-2007 04:37 AM
тАО03-19-2007 04:37 AM
Re: How to find file newer than another while limiting the find criteria...
1. touch -t 200701010001 jan1
2.find APSOLUTEPATH -type f -name '*.out' -newer APSOLUTEPATH/jan1 > /var/tmp/out
3. Then i wrote a for loop to copy files...
for i in $FILE; do cp -p $i destdir; done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-19-2007 05:07 AM
тАО03-19-2007 05:07 AM
Re: How to find file newer than another while limiting the find criteria...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-19-2007 05:24 AM
тАО03-19-2007 05:24 AM
Re: How to find file newer than another while limiting the find criteria...
Could you please provide an example?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-19-2007 05:24 AM
тАО03-19-2007 05:24 AM
Re: How to find file newer than another while limiting the find criteria...
I meant Clay....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-19-2007 05:44 AM
тАО03-19-2007 05:44 AM
Re: How to find file newer than another while limiting the find criteria...
#!/usr/bin/sh
typeset TDIR=${TMPDIR:-/var/tmp}
typeset T1=${TDIR}/Timestamp_${$}_1
typeset T2=${TDIR}/Out_${$}_2
trap 'eval rm -f ${T1} ${T2}' 0 1 2 15
touch -t 200701010001 ${T1}
find ABSOLUTEPATH -type f -name '*.out' -newer ${T1} > ${T2}
...
...
Note that your temporary files now observe the TMPDIR convention so that if TMPDIR is set, it is used and if not it defaults to /var/tmp. The temporary files have been changed to use the PID as part of the filename so that multiple runs of the same script can happily coexist although you probably should pass the touch date as an argument.