The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Writing the script jess_t03 Shell Programming and Scripting 1 10-10-2007 02:17 AM
Startup script to clean out trash can Andrek OS X (Apple) 4 10-19-2006 12:34 PM
clean up script mpang_ Shell Programming and Scripting 1 07-17-2006 08:14 PM
What files are writing to a directory hattorihanzo UNIX for Dummies Questions & Answers 3 01-17-2006 08:00 AM
Directory clean up jango AIX 4 08-25-2004 06:00 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-26-2006
Registered User
 

Join Date: Mar 2006
Posts: 28
Stumble this Post!
writing script to clean up a directory

I have to do a directory clean up on several machines. The task is as follows:
go to a particular directory (cd /xxx)
1. create a directory ' SCRIPTCLEANUP ' ( i KNOW IT)

loop through
2. List the directory

3. if directory and start with 'DQA' leave it,
4. if directory or file move it to the newly crated directory ( blanck directory delete)

5. It also requires to produce a report like this

The directory contains xx unnecessary files and yy directory. The details are as follows:


Directory



Files

endlook

i started but not complete
ssh to server
cd /xxx
mkdir scriptcleanup

for i in *
do

if [ -f $i || -d (^DQA $i) ]
mv $i ./scriptcleanup
fi

ech $ > report ( but i do not know how to insert in particular place like under Files or
Directory section in the output file. )


done


Note: I am working in ksh environment.

Thanks in advance
Reply With Quote
Google The UNIX and Linux Forums
Forum Sponsor
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:12 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0