Solved

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

Posted on 2006-10-21
3
845 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
ID: 17782563
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
ID: 17783324
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
ID: 17784750
thanks it works well.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 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

14 Experts available now in Live!

Get 1:1 Help Now