The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to list files Created in last 2 hrs rsonakiya UNIX for Dummies Questions & Answers 4 03-02-2009 07:25 AM
Files created in last 24 hours jayaramanit Shell Programming and Scripting 1 09-08-2007 04:34 AM
command to list files that are created before some date csreenivas SUN Solaris 3 06-27-2007 06:34 PM
I want to get the file which created the error when the find command was run guhas Shell Programming and Scripting 1 10-21-2005 03:06 PM
command unix to list all files created since n month ago yacsil Shell Programming and Scripting 8 12-15-2003 01:12 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-11-2007
jayaramanit jayaramanit is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 28
list the file created before 24 hours using ls command

I want to list the files created before past 24 hours using ls command.

please help me on this
  #2 (permalink)  
Old 09-11-2007
ajcannon ajcannon is offline
Registered User
  
 

Join Date: Aug 2007
Location: Binfield, Berkshire. UK
Posts: 91
Using ls

Don't think you can using ls

Look at using find with the -ctime switch

It would be something like

find <dir> -ctime n -exec ls -l {} \;

the n refers to files whoses status has changed n x 24 hours ago
  #3 (permalink)  
Old 09-11-2007
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,847
With zsh:

Code:
ls *(mh+24)

Where "files" = plain files, dotfiles, dirs, special files etc.
  #4 (permalink)  
Old 09-11-2007
psiva_arul's Avatar
psiva_arul psiva_arul is offline
Registered User
  
 

Join Date: Jul 2007
Location: Bangalore, India
Posts: 97
How can i rollback the deleted file in UNIX?

Hi,

I am using the remote UNIX server, i have used "rm" command in my unix bin promt, all files are deleted from the bin folder, So, Now i want to rollback the deleted files in my UNIX server. how can it possible?

Thanks in advance.

Thanks,
Siva.P
Bangalore
India.
  #5 (permalink)  
Old 09-11-2007
quintet quintet is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 94
you can do that with find command

find . -type d ! -name '.' -prune -o -type f -mtime +1 -print
  #6 (permalink)  
Old 09-11-2007
DILEEP410 DILEEP410 is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 148
Post

Quote:
Originally Posted by quintet View Post
you can do that with find command

find . -type d ! -name '.' -prune -o -type f -mtime +1 -print
Can you please explain the above command - what each attribute will do?

With Regards
Dileep Pattayath
  #7 (permalink)  
Old 09-11-2007
quintet quintet is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 94
Yeah Sure...

find . -type d ! -name '.' -prune -o -type f -mtime +1 -print

As you know, find command will start from the directory u have mentioned and will descend into the subdirectories..

What I assumed from the question was.. i should display all the files in the current directory that are created before a day...

the first attribute list

-type d ! -name '.' -prune

if the type is a direcorty ('d' ) and if it is not current ('.') then do not descend into it...

-o or option

-mtime +1

modification time more than a day or more than 24 hours..

you can also use -ctime if u wanna keep track of inode changes as well...

-print - will print the file name
Closed Thread

Bookmarks

Tags
mtime

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:43 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0