HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script
Operating System - HP-UX
        1839875
        Members
    
    
        3599
        Online
    
    
        110156
        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
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
09-12-2008 07:54 AM
09-12-2008 07:54 AM
			
				
					
						
							Script
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						I am storing the configuration information in a directory and then append the date to it. I am fine upto this point. I want to add some more functionality to it. i-e after storing the information, I want to keep the last 5 directories (5 most recent directories ) and delete the other.
Directories names have the following format:
drwxrwxrwx 2 root users 8192 Sep 12 11:50 lvm.120908
drwxrwxrwx 2 root users 8192 Aug 13 11:49 lvm.130808
		
		
	
	
	
Directories names have the following format:
drwxrwxrwx 2 root users 8192 Sep 12 11:50 lvm.120908
drwxrwxrwx 2 root users 8192 Aug 13 11:49 lvm.130808
		3 REPLIES 3
	
	            
            
		
		
			
            
                - Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2008 09:01 AM
09-12-2008 09:01 AM
			
				
					
						
							Re: Script
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						> Directories names have the following format:
Step 1: Use a date format like yyyy=mm-dd,
so that the names naturally sort into date
order. Then simple programs like "head" or
"tail" can be used to find the last or first
N items in the list.
		
		
	
	
	
Step 1: Use a date format like yyyy=mm-dd,
so that the names naturally sort into date
order. Then simple programs like "head" or
"tail" can be used to find the last or first
N items in the list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2008 10:11 AM
09-12-2008 10:11 AM
			
				
					
						
							Re: Script
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						Or - you could just use ls -t or ls -rt to get the names in order of time modified, then use head or tail.
Pete
	
Pete
			
			
				
			
			
			
			
			
			
		
		
		
	
	
	
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2008 06:56 PM
09-12-2008 06:56 PM
			
				
					
						
							Re: Script
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						>Pete: you could just use ls -t or ls -rt to get the names in order of time modified,
This would fail if you just happened to remove a junk file in the directory. The right solution as Steven says is to use rational date formats and not chauvinistic ones.
ISO 8601
http://www.iso.org/iso/date_and_time_format
		
		
	
	
	
This would fail if you just happened to remove a junk file in the directory. The right solution as Steven says is to use rational date formats and not chauvinistic ones.
ISO 8601
http://www.iso.org/iso/date_and_time_format
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