![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help Required: Command to find IP address and command executed of a user | loggedout | Security | 2 | 08-06-2008 05:12 PM |
| how to? launch command with string of command line options | TinCanFury | Shell Programming and Scripting | 5 | 04-28-2008 03:06 PM |
| inconsistent ls command display at the command prompt & running as a cron job | rajranibl | Linux | 5 | 07-30-2007 05:26 AM |
| How to use more than one MPE command STREAM with Unix command in a single shell? | bosskr | HP-UX | 1 | 10-16-2006 01:16 PM |
| How to use more than one MPE command STREAM with Unix command in a single shell? | bosskr | Shell Programming and Scripting | 0 | 09-19-2006 06:44 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
ls command help
I was givin the task to clear up space in one of our directories. I was wondering if their was an ls command that I can search for a certain date (i.e. all files created in 2005) to display those files and then use a wildcard to delete all files created in a certain year. If so, this would make my life alot easier. I appreciate any help.
Thanks |
| Forum Sponsor | ||
|
|
|
|||
|
dear
you can use the find command as below to find the files that have been modified more than two days ago and delete them: find /ect -type f -mtime +2 -exec rm -fr {} \; for more info see the man find regards; The Engineer IBM Certified Specialist |
|
|||
|
ls -l | awk '$8==2005{print $NF}' | xargs ls -l
will give you a long listing of all files that have 2005 in the date. This will not work for files less than 6 months old (it shows the time, not the year in all versions of UNIX I have worked in). Of course, you could get really fancy and use the system function in awk, but this is slightly faster. |
|||
| Google The UNIX and Linux Forums |
| Tags |
| mtime |
| Thread Tools | |
| Display Modes | |
|
|