Remove files based on date


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Remove files based on date
# 1  
Old 10-21-2010
Remove files based on date

Hello team,

I have a number of files in a folder which are dated yesterday and today.Can i remove all the files which i created today based on date??

is there any syntax for this ??

Last edited by vbe; 10-21-2010 at 10:03 AM.. Reason: corrected typos... and plain english please (read forum rules again!)
kanakaraju
# 2  
Old 10-21-2010
Code:
rm $(ls -lrt .|grep " Oct 21 "|awk '{print $9}')

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Not to remove Files based on property value

Hi All, Need your help to fix one script. Main agenda is: 1. Read a property file. 2. Delete all files in directory except the name from Property file. I am trying to read property file for value then deleting all files from directory except THAT value/name. I have tried so far as... (3 Replies)
Discussion started by: sukhdip
3 Replies

2. UNIX for Dummies Questions & Answers

Find the count of files by last created date based on the given date range

My unix version is IBM AIX Version 6.1 I tried google my requirement and found the below answer, find . -newermt “2012-06-15 08:13" ! -newermt “2012-06-15 18:20" But newer command is not working in AIX version 6.1 unix I have given my requirement below: Input: atr files: ... (1 Reply)
Discussion started by: yuvaa27
1 Replies

3. Shell Programming and Scripting

finding the files based on date..

Hi to every one , i had ascenario like this.. i had path like export/home/pmutv/test/ in this i will recive 43 files daily with each file having that days date i.e like product.sh.20110512 like this i will 43 files every day i had to find the files. if files are avaliable i... (2 Replies)
Discussion started by: apple2685
2 Replies

4. Shell Programming and Scripting

Deleting the files based on the date's

I have to write one script which will delete the files in the below passion. If today is 17-Feb-2010 then the script delete only 17-JAN-2010 files from the directory. Could you please help me, How will I delete the files when the year is leap year, if today is 30th Mar 2010 then how will... (1 Reply)
Discussion started by: kandi.reddy
1 Replies

5. Shell Programming and Scripting

Copy files based on date

Hi all i am having so many files in my directory.Is there any option to copy files based on date. example i am having file this -rw-rw-r-- 1 ram user 1 Feb 2 17:12 abc -rw-rw-r-- 1 ram user 1 Feb 2 17:12 bnw -rwxrwxr-x 1 ram user 21122 Feb 4... (3 Replies)
Discussion started by: suryanarayana
3 Replies

6. Shell Programming and Scripting

Get the newest files based on date

Hello friends, I'm learning to script, and I need help. How can I get the latest/newest files based on date? the format is as following: Feb 07 19:25 TESTPWD_file_1vk6pn40_19519_1 Feb 07 19:46 TESTPWD_file_1uk6pn40_19518_2 Feb 07 19:47 TESTPWD_file_20k6pn40_19520_2 Feb 07 19:56... (5 Replies)
Discussion started by: Beginer0705
5 Replies

7. UNIX for Dummies Questions & Answers

To remove files before certain date

I juz started to pick up unix nott long. What i am gonna do here is to try and remove some files before a date. (example 1st Oct 2008) Format of files name: fileA_2008MMDD I did a ls -lrt to list all the files Followed by rm 200801** .. .. ..... (4 Replies)
Discussion started by: Attitude
4 Replies

8. Shell Programming and Scripting

Count of files based on date?

Hi Friends, Can anyone help me with this: To get the count of files that are existing in a directory created on a perticular date like in the example (01/08) .(having same pattern for the filename) ex: FileName Creted Date FILE001 01/08/2007 FILE005 ... (6 Replies)
Discussion started by: sbasetty
6 Replies

9. Shell Programming and Scripting

how to remove files with a date

I have files with a date name ( 20060506 20060507 etc..) that i want to remove because it keeps filling up the directory. Can someone please help me with a script to remove those date files. i would like to keep atleast 14 days worth from the current date. I hope i have explained it clearly and... (5 Replies)
Discussion started by: justintime
5 Replies

10. UNIX for Dummies Questions & Answers

Remove files based on date

I am trying to write a shell script that will remove files in a directory based on the date. For instance, remove all files older than yesterday. Any ideas? (4 Replies)
Discussion started by: hshapiro
4 Replies
Login or Register to Ask a Question