Linux / UNIX Tech Support Forum
This is a discussion on Shell Script To Check Null Files ( size greater than zero ) within the Shell scripting forums, part of the Development/Scripting category; Hello, I have a script to find orphaned files and directories. After running it saves it ouput under /tmp. I ...
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hello,
I have a script to find orphaned files and directories. After running it saves it ouput under /tmp. I want to add a functionality to it so that it print in that file that no orphan files were found if the script did not find anything. I am pasting the script for clarity. Can someone help me in adding that functionality. Code:
#!/usr/bin/sh
OSTYPE=`uname -s`
TEMP=/tmp/orphan
case $OSTYPE in
HP-UX)
find / -xdev \( -type f -o -type d \) \( -nouser -o -nogroup \) > ${TEMP} 2>&1;;
AIX)
find / ! -fstype nfs \( -type f -o -type d \) \( -nouser -o -nogroup \) > ${TEMP} 2>&1;;
*)
find / -local \( -type f -o -type d \) \( -nouser -o -nogroup \) > ${TEMP} 2>&1;;
esac
exit 0
Last edited by nixcraft; 22-05-2009 at 02:21 AM. |
| Sponsored Links | ||
|
|
![]() |
| Tags |
| linux , shell scripting , test , test file size , unix |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Backup Shell Script That Searches for all the files greater then 200 bytes | nextcmchiranjeevi | Shell scripting | 2 | 11-02-2009 11:44 PM |
| Shell script to check the disk space on remote systems | vijayscripts | Shell scripting | 5 | 21-10-2007 06:29 PM |
| Shell script for automatic conversion of files in tar files | kasimani | Shell scripting | 2 | 08-02-2007 03:45 PM |
| shell script to open log files and check for faults | trueman82 | Shell scripting | 1 | 23-11-2006 02:35 AM |
| Linux command to check size of hard drive disk | gbdood | Linux software | 2 | 27-08-2006 09:44 AM |