eileen1017
MIS
The purpose of my script is to go through a directory of all the files. Look at the creation date for those files. Say for example, if a file is created in 2008, I will create a 2008 folder under the directory and move the file into the new 2008 folder and loop through the whole directory with all the files. But one thing I am not so sure is how to read the date for the files? And how can I perform the unix mkdir and mv command inside the perl script?
The directory files listed as follows:
-rw-r--r-- 1 oracle dba 248608 Oct 2 2007 relnote_stnd_18.fle
-rw-r--r-- 1 oracle dba 350187 Oct 15 2007 relnote_stnd_19.fle
-rw-r--r-- 1 oracle dba 296794 Oct 15 2007 relnote_stnd_20.fle
-rw-r--r-- 1 oracle dba 154456 Oct 23 2007 relnote_stnd_21.fle
-rw-r--r-- 1 oracle dba 140559 Oct 23 2007 relnote_stnd_22.fle
#!/usr/bin/perl
opendir (DIR, "/dsk01/oradata/rtest/udump");
foreach my $file (readdir(DIR)) {
next if $file =~ /^\./; #skip ., .., etc
(Need to know who to read the date and perform unix command.)
}
closedir (DIR);
Please Advice. Thank you very much.
The directory files listed as follows:
-rw-r--r-- 1 oracle dba 248608 Oct 2 2007 relnote_stnd_18.fle
-rw-r--r-- 1 oracle dba 350187 Oct 15 2007 relnote_stnd_19.fle
-rw-r--r-- 1 oracle dba 296794 Oct 15 2007 relnote_stnd_20.fle
-rw-r--r-- 1 oracle dba 154456 Oct 23 2007 relnote_stnd_21.fle
-rw-r--r-- 1 oracle dba 140559 Oct 23 2007 relnote_stnd_22.fle
#!/usr/bin/perl
opendir (DIR, "/dsk01/oradata/rtest/udump");
foreach my $file (readdir(DIR)) {
next if $file =~ /^\./; #skip ., .., etc
(Need to know who to read the date and perform unix command.)
}
closedir (DIR);
Please Advice. Thank you very much.