Removing old folders


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Removing old folders
# 1  
Old 04-07-2006
Removing old folders

All

Please help me to remove old files. For example

/usr/exp/ - inside this

Apr 02 - dir02
Apr 03 - dir03
Apr 04 - dir04
Apr 05 - dir05
Apr 06 - dir06
Apr 07 - dir07
Apr 03 - file03

I want to delete all the folders 2 days before created.Not the fil03 even though it is 2 days old.

Please help me to write shell script. Iam working in AIX.

Thanx in advance

Regards
Deepak Xavier
# 2  
Old 04-07-2006
I'm not so sure

I'm just a bit confused by the description, but generally spealking you prpbably need something like that below. Tweek it according to you requirements:
find /usr/exp/ -ctime +2 | xargs rm
"UNIX Essentials and Core" DVD explains it.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Recursivly rename folders removing characters as required

HI guys here's hoping some on pout the can help I have a large library of epub and mobi file creates some what by calibre. Output of tree listing below I would like to recursively rename the directories removing the brackets and numbers I have been scratching my head over... (4 Replies)
Discussion started by: dunryc
4 Replies

2. Shell Programming and Scripting

Removing folders - hierarchical stored

my data files are stored in such way like year->month->day-> data files, my requirement is to find out number of days of files from today to the starting day of storig files. root directory = work/user/year->month->day-> data files structure is as follows 2013->05->as of today there are 01... (7 Replies)
Discussion started by: princetd001
7 Replies

3. Shell Programming and Scripting

Removing folders with specific name/part

Hi, I need a way to remove all folders that contain "Quick" in their names in a directory called /var/tmp... However all attemps I have tried won't work. :wall: I so far tried find /var/tmp -type d -name "Quick" | sudo xargs rm -rf find . -name "Quicklook" -exec rm -rf {} \; find .... (2 Replies)
Discussion started by: pasc
2 Replies

4. UNIX for Dummies Questions & Answers

Removing Extra Folders From a TAR

I use an extremely simple TAR function for files at work and I have a question about cleaning them up. My command is TAR -cvf ExampleTarName.tar then the folder I wish to TAR. When my TAR finishes and I double click it to check it unarchived beautifully (I don't do this with every file, duh)... (5 Replies)
Discussion started by: Dogtown24
5 Replies

5. UNIX for Dummies Questions & Answers

Removing empty folders

Hello, I have a folder that contains all my music. Recently, I started using a different media player, and I let it manage my music folder. It has sorted all my music neatly in folders by artist and album. However, all the old folders that the songs used to be in are still there, yet they are... (2 Replies)
Discussion started by: emveedee
2 Replies

6. Shell Programming and Scripting

how to remove inner files without removing child folders

Hi, I want to write a command to remove all the files from a folder and inner child folder without removing the child folders of parent folder. like I have folder like this... Code: folder a/b/c file a/test.sql file a/b/test2.txt file a/b/c/temp.jpeg now I want to remove... (5 Replies)
Discussion started by: mkashif
5 Replies

7. Red Hat

how to remove inner files without removing child folders

Hi, I want to write a command to remove all the files from a folder and inner child folder without removing the child folders of parent folder. like I have folder like this... folder a/b/c file a/test.sql file a/b/test2.txt file a/b/c/temp.jpeg now I want to remove all... (2 Replies)
Discussion started by: mkashif
2 Replies

8. Shell Programming and Scripting

Help needed removing two top level folders from path

Hi, I am trying to use either awk or sed to drop the first two folders in a path. So if I had path /folder1/folder2/folder3/folder4.... I need to drop folder1&2, so the new path would be /folder3/folder4... If folder1 and folder2 were the same all the time, this would be easy. But... (4 Replies)
Discussion started by: robertinohio
4 Replies

9. UNIX for Dummies Questions & Answers

Removing empty folders using 'find'

Hey there! I try to use 'find' to remove empty directories like this: find . -depth -type d -empty -exec rm -rf {} ';' It works just fine, but there are some directories i want to exclude. So i tried to do sth like this: find . -depth -type d -empty -exec grep -v "not this one please" -exec... (5 Replies)
Discussion started by: deTTo
5 Replies

10. UNIX for Dummies Questions & Answers

Removing empty folders using the "find" command

Hi I'm trying to remove empty sub-folders from 1 main folder using the find method, but the "- empty" parameter isn't recognized by my Unix version. Any idea how to implement such thing? Thanks. (3 Replies)
Discussion started by: biot
3 Replies
Login or Register to Ask a Question