- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- mv files by sorting 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
06-06-2002 05:39 PM
06-06-2002 05:39 PM
Good tips are so helpful..
Any body helps me.. please..
About 90000 files should be moved other directories by the date which is the files has been created..
How can I complete it
Help me..thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2002 05:49 PM
06-06-2002 05:49 PM
Re: mv files by sorting date..
Use find with the -ctime option eg. mv files 10 days ago (as dated in ls -la):
# cd /olddir
# find . -ctime 10 -exec mv {} \; /newdir
Before you run it on production, test it out first by doing this:
# cd /olddir
# find . -ctime 10 -print
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2002 06:00 PM
06-06-2002 06:00 PM
Re: mv files by sorting date..
but that's not what I want.
files has been created about 2years ago..
Using ctime is not applicable..
can anyone help me?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2002 06:08 PM
06-06-2002 06:08 PM
Re: mv files by sorting date..
You may encounter a problem where the 'find' command cannot process so many files using the
'-exec' arguement This is typical on 10.20 systems. The real answer is to change the 'large_ncargs_enabled' parameter in your kernel to the value of '1'
The default is 20478 bytes, (value 0) but you can increase this value to 2048000 by changing the kernel parameter.
You can use the command 'getconf ARG_MAX' to see. You need to make sure that have patch PHKL_16751 installed.
$ getconf ARG_MAX
20478
or:
# find /filesystem -ctime 10 | xargs mv /newfilesystem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2002 06:10 PM
06-06-2002 06:10 PM
Re: mv files by sorting date..
Are you looking for an exact file timestamp (e.g. exactly 2 years ago) or a range of timestamps (e.g. 1-2 years ago).
If it is exactly two years ago, then:
# cd /olddir
# find . -ctime 730 -print
# find . -ctime 730 -exec mv {} \; /newdir
If it is from 2 years go to 1 year ago (period of 1 year), then:
# cd /olddir
# find . -ctime -730 ! -ctime -365 -print
# find . -ctime -730 ! -ctime -365 -exec mv {} \; /newdir
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2002 06:21 PM
06-06-2002 06:21 PM
Re: mv files by sorting date..
I post some files..in my box.
see attached files..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2002 06:33 PM
06-06-2002 06:33 PM
Re: mv files by sorting date..
How about something like this. This will move all files in year 2000 to /newdir:
# cd /olddir
# ll > filelist
# for i in `cat filelist | awk '{print $9}'` ; do if ll $i | awk '{print $8}' | grep " 2000 " ; then echo $i ; mv $i /newdir ; fi ; done
If you want to move all files dated Nov 4 2000, then
# cd /olddir
# ll > filelist
# for i in `cat filelist | awk '{print $9}'` ; do if ll $i | grep " Nov 4 2000 " ; then echo $i ; mv $i /newdir ; fi ; done
Note that there are two spaces between Nov and 4 and two spaces between 4 and 2000. Above only shows a single space due to forum display limitation.
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2002 06:34 PM
06-06-2002 06:34 PM
SolutionWe get files from the Mobile switcehs ie call data record and oftern we have to do the same stuff . What i essentailly do is to build a list of the files and then use that list to move them around tape direcotries . The list is build not on find as *time sometimes get confusing what is done is that I use awk like this
ls -l | awk '{if($6=="Jun" && $7=="6") print $NF}' > June6
This will all teh files which match the date creation to Jun6 , then I use this list to move the files around using cp or tar etc etc.
Manoj Srivastava