Solved

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

Posted on 2006-10-21
3
848 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iSeries FTP Exit Program 8 163
Window placement 17 95
How to convert MFC::CString to UTF8 wchar_t* 10 387
wordappend challenge 8 225
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.

730 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