Solved

Script to check the time stamp of a file and then move it

Posted on 2006-10-21
3
844 Views
Last Modified: 2013-12-26
I'm looking for a script that will monitor a directory and move any file that has been sitting in that directory for more than 15 seconds into another directory. Shell script or perl are welcome.

0
Comment
Question by:2xdafun
3 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 100 total points
Comment Utility
perl -e 'while( sleep 1 ){ $^T=time; rename $_,"/another/directory/$_" or warn "$_ $!" for grep -f && -M > 15/(60*60*24), <*> }'
0
 
LVL 43

Expert Comment

by:ravenpl
Comment Utility
ozo: You aware that 'sleep 1' in fact may fail to sleep 1 second? In such case it returns 0 :(
while(1) { sleep 1; ... # is somehow safer... Or
while(sleep 1,1) {...
0
 

Author Comment

by:2xdafun
Comment Utility
thanks it works well.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now