Computer Hope

Software => BSD, Linux, and Unix => Topic started by: Ramesh0129 on August 21, 2009, 09:28:50 AM

Title: How to get the COMPLETE last modified DATE and TIME for files OLDER than 6 Month
Post by: Ramesh0129 on August 21, 2009, 09:28:50 AM
Hi UNIX GURUs,

Please help me in finding a solution for the following strange question. I have a unique requirement for which I need to get the COMPLETE TIME STAMP of last modified DATE and TIME (that should include all time stamp parameters: YEAR, MONTH, DAY, HOUR and TIME) for all the files in the given folder/directory.

At present I tried different forms of LS command, but the “ls” command is not giving the YEAR information for the most recent files that are last updated recently (with in 6 months), and at the same time for the files that are last modified more than 6 months ago, it is not giving the HOURS and MINUTES information. Basically for the older files, the YEAR is replacing the HOUR and TIME information.

My requirement is that I need to get all the time stamp parameters (Year, Month, Day, Hour and Minutes) for all the files.

Thank you very much for your time and any help is much appreciated.

Sincerely,
Unix Newbie.
Title: Re: How to get the COMPLETE last modified DATE and TIME for files OLDER than 6 M
Post by: smeezekitty on August 21, 2009, 01:45:00 PM
i am not very good with UNIX ether and i dont like it
but i think it is
Code: [Select]
dir --full-time
Title: Re: How to get the COMPLETE last modified DATE and TIME for files OLDER than 6 Month
Post by: Ramesh0129 on August 24, 2009, 08:38:52 AM
Thank you Smeezekitty. For some reason the DIR command is not working on my system. I am getting a message "dir: command not found." I am working on SOLARIS Operating System.
Title: Re: How to get the COMPLETE last modified DATE and TIME for files OLDER than 6 M
Post by: smeezekitty on August 24, 2009, 11:19:31 AM
hmm thats funny
i dont think that works on ls
Title: Re: How to get the COMPLETE last modified DATE and TIME for files OLDER than 6 Month
Post by: Quantos on August 24, 2009, 11:50:38 AM
Thank you Smeezekitty. For some reason the DIR command is not working on my system. I am getting a message "dir: command not found." I am working on SOLARIS Operating System.

That's because he gave you a DOS command.  It obviously won't work with UNIX.

Sit tight and someone that DOES know will be along.
Title: Re: How to get the COMPLETE last modified DATE and TIME for files OLDER than 6 M
Post by: smeezekitty on August 24, 2009, 11:52:03 AM
some unix systems hvae dir built in
Title: Re: How to get the COMPLETE last modified DATE and TIME for files OLDER than 6 M
Post by: BC_Programmer on August 24, 2009, 11:57:31 AM
some unix systems hvae dir built in


none that I've ever seen.
Title: Re: How to get the COMPLETE last modified DATE and TIME for files OLDER than 6 M
Post by: smeezekitty on August 24, 2009, 11:59:12 AM
depends on the shell
Title: Re: How to get the COMPLETE last modified DATE and TIME for files OLDER than 6 Month
Post by: gh0std0g74 on August 28, 2009, 07:56:02 PM
That's because he gave you a DOS command.  It obviously won't work with UNIX.

Sit tight and someone that DOES know will be along.
dir comes from GNU coreutils, and yes, it definitely is a linux command (as well).
basically its the same as ls -C -b. check info coreutils 'dir invocation' for more info.
Title: Re: How to get the COMPLETE last modified DATE and TIME for files OLDER than 6 M
Post by: smeezekitty on August 28, 2009, 09:35:32 PM
you could download the GNU utils or try
ls --full-time
Title: Re: How to get the COMPLETE last modified DATE and TIME for files OLDER than 6 Month
Post by: Salmon Trout on August 29, 2009, 08:25:24 AM
advice to Solaris user: "Download the GNU utils"  ::)
Title: Re: How to get the COMPLETE last modified DATE and TIME for files OLDER than 6 M
Post by: smeezekitty on August 29, 2009, 11:31:13 AM
if u comile from source they should work fine
Title: Re: How to get the COMPLETE last modified DATE and TIME for files OLDER than 6 Month
Post by: Salmon Trout on August 29, 2009, 11:34:12 AM
If you are running Solaris (a kind of Unix) you don't need any "GNU utils"; you just need to write a shell script. I should have thought that an expert like you would have realised that.
Title: Re: How to get the COMPLETE last modified DATE and TIME for files OLDER than 6 Month
Post by: gh0std0g74 on August 29, 2009, 05:36:12 PM
@salmon, how about showing smeeze how its done then , on Solaris.