Delete file to day


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Delete file to day
# 1  
Old 06-16-2016
Delete file to day

friends

how I can delete files from a directory for the current date?
# 2  
Old 06-16-2016
Code:
find directory -mtime -1 -delete

# 3  
Old 06-16-2016
Quote:
Originally Posted by RudiC
Code:
find directory -mtime -1 -delete

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Delete records that do not belong to that day

i have a requirement to delete records that do not belong to that day. For example in a file that came on July 31st ,2018 there are records that belong to Aug 1st,2018 as well and I want to find and delete those records. I want to delete anything with 01-Aug-2018. I have several files like that. I... (6 Replies)
Discussion started by: Priya
6 Replies

2. Shell Programming and Scripting

Julian day to dates in YEAR-MONTH-DAY

hello, I have many files called day001, day002, day003 and I want to rename them by day20070101, day20070102, etc. I need to do it for several years and leap years as well. What is the best way to do it ? Thank you. (1 Reply)
Discussion started by: Ggg
1 Replies

3. UNIX for Dummies Questions & Answers

Move the files between Current day & a previous day

Hi All, I have a requirement where I need to first capture the current day & move all the files from a particular directory based on a previous day. i.e move all the files from one directory to another based on current day & a previous day. Here is what I am trying, but it gives me errors.... (2 Replies)
Discussion started by: dsfreddie
2 Replies

4. Shell Programming and Scripting

How to delete subdirectories that are more than 1 day old AND have NO files on them

Hi Experts , At a particular dir , How to delete subirectories that are more than 1 day old AND have NO files in them. PS : -empty option is not working at my Sun OS version. Thanks, A (6 Replies)
Discussion started by: ajaypatil_am
6 Replies

5. Shell Programming and Scripting

How to delete files which more than one Day old?

I have a directory /opt/targets which generates more than 1000 files per day and I want to delete all the files which are more than 1 day old...ie 24hrs+ Please help.. (3 Replies)
Discussion started by: sunilrk07
3 Replies

6. Shell Programming and Scripting

Script to find previous month last day minus one day timestamp

Hi All, I need to find the previous month last day minus one day, using shell script. Can you guys help me to do this. My Requirment is as below: Input for me will be 2000909(YYYYMM) I need the previous months last day minus 1 day timestamp. That is i need 2000908 months last day minus ... (3 Replies)
Discussion started by: girish.raos
3 Replies

7. Shell Programming and Scripting

Not able to delete the files in day wise...

Dear All, I am not able to remove the files in my AIX 5.3 server. My files List /iims-home/data/uat1/batch/staging -rw-r--r-- 1 iims iims 5743 Jun 12 09:04 ErrorReport2008-05-20 09-04-18.doc -rw-r--r-- 1 iims iims 191213683 Jun 12 09:05... (1 Reply)
Discussion started by: bvijaycom
1 Replies

8. Shell Programming and Scripting

Write a shell script to find whether the first day of the month is a working day

Hi , I am relatively new to unix... Can u pls help me out to find out if the first day of the month is a working day ie from (Monday to Friday)...using Date and If clause in Korn shell.. This is very urgent. Thanks for ur help... (7 Replies)
Discussion started by: phani
7 Replies

9. Shell Programming and Scripting

delete files one day old in current month only

i want to delete files that are one day old condition is files should be of current month only ie if iam running script on 1 march it should not delete files of 28 feb(29 if leap year :-)} any modifications to find $DIR -type f -atime +1 -exec rm -f{}\; (4 Replies)
Discussion started by: maverick
4 Replies

10. Shell Programming and Scripting

How to compare prev day file to current day file

Hi all: I am new to this board and UNIX programming so please forgive if I don't explain something correctly. I am trying to write a script to keep track of our links, we link one program written for Client A to Client B's directory. What we want to do is to keep track of our linked programs... (1 Reply)
Discussion started by: Smurtzy
1 Replies
Login or Register to Ask a Question