The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
grep latest file based on date. lweegp Shell Programming and Scripting 12 04-03-2009 03:10 AM
Processing a log file based on date/time input and the date/time on the log file primp Shell Programming and Scripting 4 03-16-2008 11:23 AM
Based on the permision in the dir can i delete the file arunkumar_mca UNIX for Dummies Questions & Answers 4 01-08-2008 01:59 PM
Need to delete the files based on the time stamp of the file samudha UNIX for Dummies Questions & Answers 2 06-20-2007 07:02 AM
i want to delete a file based on existing file in a directory srivsn Shell Programming and Scripting 3 04-11-2006 04:38 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-30-2008
adzuanamir adzuanamir is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 40
Delete File Based On Date

Hi Xpert Out There

I have a lots of file in this path :

-rw-r----- 1 oracle dba 3954176 Dec 21 2006 1_2008.dbf
-rw-r----- 1 oracle dba 887808 Dec 21 2006 1_2009.dbf
-rw-r----- 1 oracle dba 143872 Dec 21 2006 1_2010.dbf
-rw-r----- 1 oracle dba 33792 Dec 21 2006 1_2011.dbf
-rw-r----- 1 oracle dba 1536 Dec 21 2006 1_2012.dbf
-rw-r----- 1 oracle dba 1024 Dec 21 2006 1_2013.dbf
-rw-r----- 1 oracle dba 31744 Dec 21 2006 1_2014.dbf
-rw-r----- 1 oracle dba 104857088 Dec 22 2006 1_2015.dbf
-rw-r----- 1 oracle dba 104857088 Dec 24 2006 1_2016.dbf
-rw-r----- 1 oracle dba 1048064 Dec 24 2006 1_2017.dbf
-rw-r----- 1 oracle dba 104857088 Dec 25 2006 1_2018.dbf
-rw-r----- 1 oracle dba 1048064 Dec 25 2006 1_2019.dbf

Now i want to delete all file date on 2006 with single command. How to do this???
By the way, i'm using solaris 9....TQ in advance
  #2 (permalink)  
Old 07-30-2008
rubin's Avatar
rubin rubin is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2007
Posts: 321
One way,

Code:
ls -l | /usr/xpg4/bin/awk '$8==2006 && /^-/ && $0=$NF' | xargs rm
  #3 (permalink)  
Old 07-30-2008
adzuanamir adzuanamir is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 40
Tq rubin....
  #4 (permalink)  
Old 07-30-2008
abeware abeware is offline
Registered User
  
 

Join Date: Jul 2008
Location: Sweden
Posts: 2
Or you can use 'find' and pipe the output to the 'xargs rm' rubin provided.
but since these files most likely are database files you might want to consult your local dba if he/she for some reason wants to keep them :-)
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 11:47 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0