perl find directory only if modified in last hour


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting perl find directory only if modified in last hour
# 1  
Old 10-12-2007
perl find directory only if modified in last hour

I want a one liner perl command to find a directory only if the modified time is within the last hour

I am running this on windows - and I will define a variable for the result.

So for example I want to return value of 1 for the variable if the modified time of d:\test1 is within the last hour. If it hasnt been modified within the last hour I want to return a value of 0 for the variable so I can then print the variable name and its value to a file..

Can you help?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

To find the latest modified file in a directory

I am trying to fetch the latest modified file from a directory using the command find . -type f -exec ls -lt \{\} \+ | head | awk '{print $9}' After the O/P, I get the below mentioned error and the command doesnt terminate at all. find: ls terminated by signal 13 find: ls terminated by... (2 Replies)
Discussion started by: Sree10
2 Replies

2. Shell Programming and Scripting

Find users in 24 hour

How can I find that time when maximum number of users were login in last 24 hours. We have 500 users in that server. ---------- Post updated at 02:13 PM ---------- Previous update was at 01:17 PM ---------- on particular date 26-march-2013. Just for example we want to trace in which timings... (5 Replies)
Discussion started by: learnbash
5 Replies

3. Shell Programming and Scripting

Script to Change Permission on a directory after every hour

I want to change the permission of a dir to 777 after every hour in a background process.I do not have the access to the crontab , is there another way of doing it a scrit of some thing like that . Any help will be great. (1 Reply)
Discussion started by: neeraj617
1 Replies

4. Shell Programming and Scripting

last modified directory

hi everyone suppose i have many directory under one directory. now i want to find out the last modified directory so i executed the command ls -ltr but it gives me the directory structure too and i don't want this so i removed 'r' also but it too gives me directory... (2 Replies)
Discussion started by: aishsimplesweet
2 Replies

5. Shell Programming and Scripting

Copy last modified directory from path using Perl

Hi I need to copy last modified directory from path /users/bin to be copied to /tmp in a perl script ...somehow my script is not allowing me to do cd /users/bin. i have tried $dir = `find /users/bin -maxdepth 1 -type d -mtime 0 ` cp -R $dir /tmp/new but it says missing destination... (1 Reply)
Discussion started by: shaveta
1 Replies

6. Shell Programming and Scripting

Copy Last modified directory to another directory

Hi, I have to copy last modified Directory to another directory.How can i Do using pipe or redirect cp -R 'ls -lrt|tail -1' test is not working. please help. (3 Replies)
Discussion started by: shaveta
3 Replies

7. Shell Programming and Scripting

Find files modified in last hour sunOS 5.10

trying to find a way to locate files modified in the last hour in a shell script, unfortunately the command 'find . -mmin -60' is not supported on SunOS 5.10 (works on OpenSolaris 5.11 :mad:) Does anyone know a method of doing this in shell script on 5.10? cheers (19 Replies)
Discussion started by: rich@ardz
19 Replies

8. Shell Programming and Scripting

Find the directory modified/created before 4 days

Hi, I have an application which creates some directories while running. I want to delete these directories which are 4 days older. i tried find . type d -mtime +1 -print And it is working fine.. but find . type d -mtime +4 -print is not giving any results which are 4 days... (6 Replies)
Discussion started by: Tuxidow
6 Replies

9. UNIX for Dummies Questions & Answers

how to use sed or perl command to find and replace a directory in a file

how to use sed command to find and replace a directory i have a file.. which contains lot of paths ... for eg.. file contains.. /usr/kk/rr/12345/1 /usr/kk/rr/12345/2 /usr/kk/rr/12345/3 /usr/kk/rr/12345/4 /usr/kk/rr/12345/5 /usr/kk/rr/12345/6 /usr/kk/rr/12345/7... (1 Reply)
Discussion started by: wip_vasikaran
1 Replies

10. Shell Programming and Scripting

If any file resides for more than an hour in this directory then to raise an alert

Hi If there is a file upload done from a remote server and if the file remains without being extracted for more than an hour, I need to identify the files and create an alert message to the users in the other end. please help me writing a shell script for it. Regards Yazhini (2 Replies)
Discussion started by: yazhini.t
2 Replies
Login or Register to Ask a Question
PIDOF(8)						Linux System Administrator's Manual						  PIDOF(8)

NAME
pidof -- find the process ID of a running program. SYNOPSIS
pidof [-s] [-c] [-n] [-x] [-o omitpid[,omitpid..]] [-o omitpid[,omitpid..]..] program [program..] DESCRIPTION
Pidof finds the process id's (pids) of the named programs. It prints those id's on the standard output. This program is on some systems used in run-level change scripts, especially when the system has a System-V like rc structure. In that case these scripts are located in /etc/rc?.d, where ? is the runlevel. If the system has a start-stop-daemon (8) program that should be used instead. OPTIONS
-s Single shot - this instructs the program to only return one pid. -c Only return process ids that are running with the same root directory. This option is ignored for non-root users, as they will be unable to check the current root directory of processes they do not own. -n Avoid stat(2) system function call on all binaries which are located on network based file systems like NFS. Instead of using this option the the variable PIDOF_NETFS may be set and exported. -x Scripts too - this causes the program to also return process id's of shells running the named scripts. -o omitpid Tells pidof to omit processes with that process id. The special pid %PPID can be used to name the parent process of the pidof pro- gram, in other words the calling shell or shell script. EXIT STATUS
0 At least one program was found with the requested name. 1 No program was found with the requested name. NOTES
pidof is actually the same program as killall5; the program behaves according to the name under which it is called. When pidof is invoked with a full pathname to the program it should find the pid of, it is reasonably safe. Otherwise it is possible that it returns pids of running programs that happen to have the same name as the program you're after but are actually other programs. Note that that the executable name of running processes is calculated with readlink(2), so symbolic links to executables will also match. SEE ALSO
shutdown(8), init(8), halt(8), reboot(8), killall5(8) AUTHOR
Miquel van Smoorenburg, miquels@cistron.nl 01 Sep 1998 PIDOF(8)