- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: find files of certain date
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
12-22-2003 07:37 PM
12-22-2003 07:37 PM
find files of certain date
I have many files with different creation date, I want to find and copy files of date 19 Dec, please help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2003 07:48 PM
12-22-2003 07:48 PM
Re: find files of certain date
Assuming you're in the correct directory already, ll|grep "Dec 19" will identify the files for you.
If you need to search sub-directories, you will need to use the find command. If I have any spare moments I'll play about with it to try to find the format you need.
Mark Syder (like the drink but spelt different)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2003 07:48 PM
12-22-2003 07:48 PM
Re: find files of certain date
# find /dir -exec ls -l {}\; | grep "Dec 19" | while read LINE
do
cp $LINE /dir
done
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2003 07:53 PM
12-22-2003 07:53 PM
Re: find files of certain date
You could look for the -mtime option of find...
-mtime n
True if the file modification time subtracted from the initialization time is n-1 to n multiples of 24 h. The initialization time shall be a time between the invocation of the find utility and the first access by that invocation of the find utility to any file specified in its path operands.
Try e.g.:
# find
Best regards...
Dietmar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2003 08:01 PM
12-22-2003 08:01 PM
Re: find files of certain date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2003 08:07 PM
12-22-2003 08:07 PM
Re: find files of certain date
Mark Syder (like the drink but spelt different)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2003 08:14 PM
12-22-2003 08:14 PM
Re: find files of certain date
Assuming, your file names don't contain " Dec 19 ", this should work...
# ls -lR
Best regards...
Dietmar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2003 08:30 PM
12-22-2003 08:30 PM
Re: find files of certain date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2003 08:42 PM
12-22-2003 08:42 PM
Re: find files of certain date
there is a slight chance to get the creation date, however no way of being sure with:
ls -lc
This shows the last modification of the inode, so if ther was no chmod or so, then this reflects the creation time.
ls -lcR
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2003 08:42 PM
12-22-2003 08:42 PM
Re: find files of certain date
# find /dir -exec ls -l {} \; | grep "Dec 19" |awk '{ print $9 }' | while read LINE do
cp /$LINE /dir
done
RJ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2003 08:44 PM
12-22-2003 08:44 PM
Re: find files of certain date
Two points: you should replace the first occurrence of /dir with the directory where the search is to start and the second one with the directory you want the files copied to. If you want to keep ownership, group, and permissions, use cp -p.
Mark Syder (like the drink but spelt different)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2003 08:47 PM
12-22-2003 08:47 PM
Re: find files of certain date
The first does not work, the second one will work if you change the search directory and the destination directory.
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2003 08:54 PM
12-22-2003 08:54 PM
Re: find files of certain date
What is when I want to do something (delete, copy...) with the files before(acces time, modify...) dec 20
This selects dec 20
find -mtime 3|grep -v "Dec 20"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2003 09:00 PM
12-22-2003 09:00 PM
Re: find files of certain date
calcualte the number of days and then
find ./ -mtime +days
greetings,
michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2003 09:03 PM
12-22-2003 09:03 PM
Re: find files of certain date
You mean older then 3 days ?
# find . -mtime +3 -exec ls -l {} ;\
copy change ls -l --> "cp -r" or "mv" or "rm -r"
Ps please start your own thread (:-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2003 09:09 PM
12-22-2003 09:09 PM
Re: find files of certain date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2003 09:19 PM
12-22-2003 09:19 PM
Re: find files of certain date
# find . /tmp -exec ls -l | grep "Dec 19" | awk '{ print $9 }' | while read LINE
do
cp $LINE /DESTANATION_DIR
done
do not use copy and paste !!!!
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2003 09:20 PM
12-22-2003 09:20 PM
Re: find files of certain date
This is the last question(corrective):
I want select the files before dec 20, and do something with them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2003 09:23 PM
12-22-2003 09:23 PM