How to compress the directories which is older than 7 days?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to compress the directories which is older than 7 days?
# 1  
Old 08-29-2013
Question How to compress the directories which is older than 7 days?

Hi all,

how to compress the directories which is older 7 days.
If any one knows please help me this is urgent.

Thanks in advance
# 2  
Old 08-29-2013
What directories?
Code:
nas:/usr $ ls -ld *
drwxr-xr-x  2 root root  20480 Oct  2  2012 bin
drwxr-xr-x  2 root root   4096 Jul 12  2011 games
drwxr-xr-x  5 root root   4096 Jul 12  2011 include
drwxr-xr-x 38 root root  12288 Dec  8  2011 lib
drwxr-xr-x 19 root root  12288 Dec  8  2011 lib32
lrwxrwxrwx  1 root root      3 Dec  8  2011 lib64 -> lib
drwxrwsr-x 10 root staff  4096 Jan 21  2011 local
drwxr-xr-x  2 root root   4096 Dec  8  2011 sbin
drwxr-xr-x 89 root root   4096 Oct  2  2012 share
drwxrwsr-x  2 root src    4096 Nov 26  2010 src

You may be surprised of the effect if you compressed here...

You have a special forum for urgent but that forum also has special rules, so do not post anything as " Ugent" elsewhere, thanks
# 3  
Old 08-29-2013
/opt/batchapps/phd in this phd directory daily created some directories and each directory is having some files i.e txt files,log files ext i want compress the directories under phd directory which is older than 7 days please help me.

Thanks in advance,
Ramesh
# 4  
Old 08-29-2013
What OS/version/shell are you on? You can find out with uname -a and echo $SHELL.
Code:
gacanepa@debian:~$ uname -a
Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.41-2 i686 GNU/Linux
gacanepa@debian:~$ echo $SHELL
/bin/bash
gacanepa@debian:~$

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to compress and delete the older logs

Hello Guys, Can you please help me with a script which zips the older log files(1-2 weeks) and delete them? I want to run the script manually instead of setting it up in a cron job. Appreciate your help. Regards, Kris (6 Replies)
Discussion started by: kriss.gv
6 Replies

2. Shell Programming and Scripting

Compress folders older than x days

hello everyone. in /opt/abc every night there is a new folder created. in that folder there is aseries of files created for that day. i would like to run a script every Sunday night at 02:00 to compress each file separately (preserving its name) who is older than 2 days. i have found this... (2 Replies)
Discussion started by: atux
2 Replies

3. Shell Programming and Scripting

Need Help in ksh Script to list files older than 365 days from specified directories

Requirement is to list the files older than 365 days from multiple directories and delete them and log the list of files which are deleted to a log file. so 1 script should only list files older than 365 days for each directory separately to a folder The other script should read these files... (7 Replies)
Discussion started by: prasadn
7 Replies

4. UNIX for Advanced & Expert Users

How to Remove 180 days older non-empty directories

Hi Gurus, I have command to delete more than 180days file. find /home/abc/ -name "CBST_*.txt*" -mtime +180 | xargs -n 100 rm -f Now I would like to delete more than 180days Non empty directory--What will be command? Following is non empty directory as instance CBST2010* (2 Replies)
Discussion started by: thepurple
2 Replies

5. Shell Programming and Scripting

Finding directories older than 5 days

Hello, Motive: Search all directories which are older than 5 days. Example: consider following directory structure: abc/dir1 abc/dir1/dir abc/dir2 abc/dir3 abc/dir3/temp Suppose dir1 and dir3 are 5 days older. Then I am looking for a command which lists abc/dir1 and abic/dir3 only so that... (4 Replies)
Discussion started by: mytempid07
4 Replies

6. Shell Programming and Scripting

Script for parsing directories one level and finding directories older than n days

Hello all, Here's the deal...I have one directory with many subdirs and files. What I want to find out is who is keeping old files and directories...say files and dirs that they didn't use since a number of n days, only one level under the initial dir. Output to a file. A script for... (5 Replies)
Discussion started by: ejianu
5 Replies

7. Shell Programming and Scripting

How to tar, compress and remove files older than two days

Hi, I'm Eddy from Belgium and I've the following problem. I try to write a ksh script in AIX to tar, compress and remove the original *.wav files from the directory belgacom_sf_messages older than two days with the following commands. The problem is that I do not find a good combination... (4 Replies)
Discussion started by: edr
4 Replies

8. Red Hat

Find files older than 30 days in directories and delete them

Hi, I have dummies questions: My script here can find the files in any directories older than 30 days then it will delete the files but not the directories. I would like to also be able to delete the directories that hold old files more than 30 days not just the files itself. find . -type f... (2 Replies)
Discussion started by: lamoul
2 Replies

9. HP-UX

Command for delete the directories which are older than 7 days

Hi, My requirement is need to delete the directories (Including files also) which are older than 7 days. So I used below command in one script (script takes 2 input parameters) #$1 - Path of the directory from where we have to delete the directories.# #$2 - Number of days older... (1 Reply)
Discussion started by: sridhar sivakot
1 Replies

10. Shell Programming and Scripting

Need to remove files older than 30 days except directories

Hi, I need to remove files (*.trc) which are older than 30 days from one location. My problem is there I do not want to visit any of the directories at that location. I want to search files at that particular location only (need to skip directorys at that location). maxdepth option is there... (6 Replies)
Discussion started by: malaymaru
6 Replies
Login or Register to Ask a Question