I want to list the files created before past 24 hours using ls command.
please help me on this
I want to list the files created before past 24 hours using ls command.
please help me on this
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
With zsh:
ls *(mh+24)
Where "files" = plain files, dotfiles, dirs, special files etc.
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.
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
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
Ok.fine.Thank you