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 Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
df -k and deleting files ajayr111 UNIX for Dummies Questions & Answers 4 03-14-2007 08:03 PM
Deleting Files bc4 UNIX for Dummies Questions & Answers 1 01-25-2007 11:27 PM
Deleting files BG_JrAdmin SUN Solaris 1 11-29-2006 01:17 AM
Deleting old files shiroh_1982 Shell Programming and Scripting 2 06-21-2006 04:42 AM
Deleting the files livetaurean19 Shell Programming and Scripting 0 06-16-2005 04:16 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-13-2007
Sheethal Sheethal is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 28
Help needed in deleting the files

Hi,

I wanted to check whether any files are available under the path /usr/app/logs/. If the files are available under this path then i have to delete all the files except the files system.log, system.log.1, system.log.2 and sub folders under this path

Can any one please help me on this?

Thanks in advance.

Last edited by Sheethal; 11-13-2007 at 05:17 AM..
  #2 (permalink)  
Old 11-13-2007
joydeep joydeep is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 13
# change the directory
$$ cd /usr/app/logs/

# See the list of files under /usr/app/logs/
$$ ls -lrt /usr/app/logs/*

# send the output into a file and exclude system.log*
$$ ls -lrt /usr/app/logs/* | grep -v system.log* > /tmp/ListOfFiles.txt

# Check the list of files
$$ cat /tmp/ListOfFiles.txt

# If it is ok, delete them
$$ for file in /tmp/ListOfFiles.txt; do rm -i $file; done

NB: Check and confirm b4 delete them
  #3 (permalink)  
Old 11-13-2007
vijayan vijayan is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 4
Hi,

Why not u try this command

Code:
rm -ir /var/log/*
Regards

Vijayan
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:33 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
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