find and remove last week dir


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers find and remove last week dir
# 1  
Old 04-14-2008
find and remove last week dir

hello all,

I want to ask, how to find last week directory and then remove it..
I have a directory in path /home/backup/
and, inside backup dir, I have 6 dir :
- 01_20080414 ( today date )
- 02_20080414 ( today date )
- 01_20080413
- 02_20080413
- 01_20080407 ( last week date )
- 02_20080407 ( last week date )

I've used grep, but I don't know how to grep last week dir, since I want to use crontab on this script.

Thank you.
# 2  
Old 04-14-2008
If the directory's age can be used, use find
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading in MM/DD/YY, find Day of Week

Hi everyone, I have a shell script that merges many files down in to one, then removes unwanted lines, that part is working fine: #!/bin/bash FILES=/home/pi/temp/qbd/* for f in $FILES do echo "Processing $f file..." # take action on each file. $f store current file name echo... (9 Replies)
Discussion started by: gjws
9 Replies

2. HP-UX

Find Day of Week

In HP-UX the date command does not have the "-d" switch like some other *nixes do. I'm working a simple script to tell me, given the day, month and year what day of the week that falls on. Assuming valid day, month and year input (I'd perform quality checks on the input separately, but not... (5 Replies)
Discussion started by: rwuerth
5 Replies

3. Solaris

remove a user without removing its home dir

HI all, I have wrongly given a wrong home directory to a user. This dir is very critical for my production environment(Can;t afford to lose it for a single minute) Now i want to delete that user, Whenever i try to delete user it tries to delete its home dir. Commnd i use: userdel ... (9 Replies)
Discussion started by: varunksharma87
9 Replies

4. Shell Programming and Scripting

KSH - Find paths of multiple files in CC (dir and sub-dir))

Dear Members, I have a list of xml files like abc.xml.table prq.xml.table ... .. . in a txt file. Now I have to search the file(s) in all directories and sub-directories and print the full path of file in a output txt file. Please help me with the script or command to do so. ... (11 Replies)
Discussion started by: Yoodit
11 Replies

5. Shell Programming and Scripting

what is the find command to find exact dir from the root

I want to find a dir called STOP from the root.so what is the find command. Thanks & Regards Rajkumar (1 Reply)
Discussion started by: rajkumar_g
1 Replies

6. Shell Programming and Scripting

A script to find dir, delete files in, and then del dir?

Hello!! I have directories from 2008, with files in them. I want to create a script that will find the directoried from 2008 (example directory: drwxr-xr-x 2 isplan users 1024 Nov 21 2008 FILES_112108), delete the files within those directories and then delete the directories... (3 Replies)
Discussion started by: bigben1220
3 Replies

7. Solaris

remove dir from inherit-pkg-dir

hi i configured zone and have 4 files /usr and /lib /platform /sbin from global zone and i want to exclude /usr/local from /usr any one has an idea ? (2 Replies)
Discussion started by: maxim42
2 Replies

8. UNIX for Dummies Questions & Answers

how to remove same file in the dir and subs?

Hi all, Let say I have abc.gif file in the dir: A A/Sub1 A/Sub2 This abc.gif file is located in each of the dir and its sub. I want to be able to remove it at once w/out going into each folder and remove it one at a time. What is the command to do that? Thanks (3 Replies)
Discussion started by: jasonhawaii
3 Replies

9. Programming

To find a existence of a dir within a dir

Hi, I want to find whether a dir "temp" is present inside a dir. It should get a dir a input and search recursively within that directory to check whether temp is present and return 1 or return 0 if it is not present anywhere inside the directory/sub-directory. I know we can use readdir in the... (1 Reply)
Discussion started by: spsenthil
1 Replies

10. UNIX for Dummies Questions & Answers

Every week one dir - How to

I need to make programmatically one dir every week Saturday, like 102106, 102806, ... 10 ==> month 21 ==> Saturdays 06 ==>Yr Any idea? (1 Reply)
Discussion started by: redlotus72
1 Replies
Login or Register to Ask a Question