#!/usr/bin/perl use Tk; use Encode; use Win32::API; use threads; use Encode::CN; use Tk::BrowseEntry; use Tk::NoteBook; require Tk::BrowseEntry; use Tk::LabEntry; use Genesis; use POSIX qw(strftime); use Win32::ODBC; use Win32; use Win32::OLE; use Win32::OLE qw(in); use Win32::OLE::Variant; use Digest::MD5 qw(md5_hex); use MIME::Base64; use Socket; use warnings; use Time::Local; use File::stat; use POSIX qw(strftime); use 5.010; require 'shellwords.pl'; #$host = shift; #$f = new Genesis($host); #$GENESIS_EDIR = $ENV{GENESIS_EDIR}; #$GENESIS_DIR = $ENV{GENESIS_DIR}; #$STEP = $ENV{STEP}; #$TMP = $ENV{TMP}; #$JOB = $ENV{JOB}; #读取这个文件的日期 $File = "d:/55.pdf"; $Date_String = strftime "%Y%m%d", (localtime stat($File)->mtime)[0..5]; print "Date_String = $Date_String \n"; my $Dir = "d:/findx"; my $File; my @Dir; opendir (DIR, $Dir) or die "can't open the directory!"; @Dir = readdir DIR; foreach $File (@Dir) { if ( $File =~ /[a-z]/) { #读取所有文件以a-z开头的文件 #if ( $File =~ /[a-z]*\.zip/) { #文件名是以字母开头,并以zip结尾的 #print "$File \n"; $Fliex = "$Dir/$File"; $Date_String = strftime "%Y%m%d", (localtime stat($Fliex)->mtime)[0..5]; print "$File = $Date_String \n"; $mtime= -M $Fliex; #文件超过6天且小于10天的,删掉 if ($mtime > 6 && $mtime < 10){ print "$mtime File Date old Than 10 Day |*| $Fliex = $Date_String \n"; unlink $Fliex; } else{ print "$mtime Not Than $Fliex = $Date_String \n"; } } else { print "Not the kind of file type you want!\n"; } }