![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using cp -r command to selectively omit *.dat files while copying a directory. | d_sai_kumar | UNIX for Dummies Questions & Answers | 5 | 07-18-2008 06:48 AM |
| Selectively splitting a file with C-shell? | fusi0n | Shell Programming and Scripting | 2 | 12-11-2007 05:06 PM |
| Specify a previous date as start date in shell script | ritzwan0 | Shell Programming and Scripting | 2 | 09-25-2006 05:58 PM |
| Shell script for Creating Directory with name as system date | aarora_98 | Shell Programming and Scripting | 7 | 12-07-2005 08:14 AM |
| script to view files based on date | krahuliyer | Shell Programming and Scripting | 6 | 10-05-2005 04:51 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
shell script to selectively tar directory based on date
hye everybody
, i'm new to the scripting world.. hope you guys can help me out with this one.. i'm trying to identify any directory under /tmp/saya that is created more than one day from the current date.. e.g, today is March 14, so any directory that has time stamp March 13 backwards, i want to tar it and put under /tmp/awak.. this is the script that i created (without the date) ### PART 1 : TO TAR FILE IN /tmp/saya AND PUT IN /tmp/awak ### cd /tmp/saya for file in * do if [[ -d $file ]] then tar -cvf /tmp/awak/$file.tar $file fi done thanks a lot! -fara |
|
||||
|
hi joeyg, thanks a lot!
![]() this is what i did.. ### PART 1 : TO TAR FILE IN /tmp/saya AND PUT IN /tmp/awak ### cd /tmp/saya for file in * do if [[ -d $file ]] then find . -mtime +1 -exec tar -cvf /tmp/awak/$file.tar $file {} \; fi done |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|