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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
monitoring a specific file on Tru64 aladdin UNIX for Dummies Questions & Answers 5 07-13-2007 11:41 AM
file monitoring problems High Level Programming 1 08-24-2006 09:30 AM
File growth monitoring jeyanthan_kr Filesystems, Disks and Memory 1 05-18-2006 03:32 PM
Monitoring a directory for new files with .xx and executing command if found krkan Shell Programming and Scripting 4 03-14-2006 11:16 PM
file system monitoring script g-e-n-o Shell Programming and Scripting 1 04-08-2002 04:36 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 10-31-2005
pete_leon pete_leon is offline
Registered User
  
 

Join Date: Oct 2005
Posts: 2
Monitoring file in a directory

Hi I need the commands that will enable me to monitor the files in a directory, preferably by date of the file and copy those files that have changed to a new directory.


Please can someone help?

Many thnaks in advance

Kind regards from

Pete
  #2 (permalink)  
Old 10-31-2005
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
Please check the FAQs before posting. If you had looked here, you would have found your answer. Check the part where find is used in conjunction with touch.
  #3 (permalink)  
Old 11-12-2005
pete_leon pete_leon is offline
Registered User
  
 

Join Date: Oct 2005
Posts: 2
find and copy -mtime -newer cp

this was the code I came up with and it does not work.

Any suggestions are much appreciated.

#!/usr/bin/ksh

Path=/home/test1
Path2=/home/test2

if find -mtime $Path -newer $Path2
then cp $Path $Path2

fi
  #4 (permalink)  
Old 11-12-2005
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
Your syntax is incorrect. The '-mtime' argument expects to be followed by a positive/negative integer or an integer without any signs preceding it.
The mtime argument will find files older than/ newer than or exactly as old as the number of days specified. Please check the man page of find on your system for more details.
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 04:48 PM.


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