There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
UNIX/Linux
Tag Cloud
adware audio blue screen boot bsod computer cpu crash dell desktop driver drivers error excel external hard drive firefox freeze freezes freezing hard drive hardware hijackthis internet internet explorer itunes laptop malware motherboard mouse network networking outlook 2007 power printer problem ram restart router screen slow sound trojan usb virus vista vista 32-bit windows windows xp winxp wireless
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Operating Systems > UNIX/Linux >
aghhh ! find and if commands.


Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
cgjoker's Avatar
Senior Member with 205 posts.
 
Join Date: Aug 2003
14-Dec-2004, 04:43 PM #1
aghhh ! find and if commands.
Im on the verge of cracking this but I just can't seem to get it going.

I think if you see the code its pretty self explanatory.
####################################################
cd /work

filemod=`find ./ -type f -mtime -3 `
filename=`find ./ -type f -name "*4*" `

if [ -z $filemod ]
then
echo "No files found equal to or older than 3 days, continuing processing."
else
echo "checked work... files exist that are older than 3 days"
echo "copying files to other directory."
cp $filemod /other/.
fi

if [ -z $filename ]
then
echo "No files found with a flag, continuing processing."
else
echo "checked work... files exist that have a flag"
echo "copying files to other directory."
cp $filename /other/.
fi
####################################################
cgjoker's Avatar
Senior Member with 205 posts.
 
Join Date: Aug 2003
14-Dec-2004, 04:55 PM #2
nevermind... I got it to work
cd /mdm_work/Campaign_Staging/FBL

filemod=`find ./ -type f -mtime +3 `
filename=`find ./ -type f -name "*4*" `

if [ $filemod ]
then
echo "files exist that are older than 3 days"
cp $filemod /other/.
else
echo "No files found equal to or older than 3 days, continuing processing."
fi

if [ $filename ]
then
echo "files exist that have a flag"
cp $filename /other/.
else
echo "No files found with a flag, continuing processing."
fi
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 05:23 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.