in reply to Re: Re: Re: ignore certain files in a folder search, and create a random .txt file
in thread ignore certain files in a folder search, and create a random .txt file

Adding your code from this post gives me good feedback on the age of the files in this directory. For instance:
C:/devl/bin/timedir/1._Checking_File_Readiness_ is > 5 minutes old C:/devl/bin/timedir/2._Checking_File_Readiness_ is > 5 minutes old C:/devl/bin/timedir/3._Checking_File_Readiness_ is > 5 minutes old C:/devl/bin/timedir/4._Checking_File_Readiness_ is > 5 minutes old C:/devl/bin/timedir/5._Checking_File_Readiness_ is > 5 minutes old C:/devl/bin/timedir/6._Checking_File_Readiness_ is > 5 minutes old C:/devl/bin/timedir/_Watched_Folder_._Active_ is > 5 minutes old C:/devl/bin/timedir/Copy (2) of Copy of notsooldfile is > 5 minutes ol +d C:/devl/bin/timedir/Copy of Copy of notsooldfile is > 5 minutes old C:/devl/bin/timedir/Copy of notsooldfile is > 5 minutes old C:/devl/bin/timedir/notsooldfile is > 5 minutes old
Now if I could tell the script to ignore *._Checking_File_Readiness_ and the file _Watched_Folder_._Active_, I think I'd be on easy street.
  • Comment on Re: Re: Re: Re: ignore certain files in a folder search, and create a random .txt file
  • Download Code

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: ignore certain files in a folder search, and create a random .txt file
by tachyon (Chancellor) on Mar 19, 2004 at 22:03 UTC

    !"£$%^)(* What code are you using! If you don't post it no one can see why it does not work. If you are using readir you have the *file name only* if using glob you have *full path* either way if you skip with REs that mathch these eithur using next if looping of ! /RE/ if grepping it will work. It should already have worked.

    m/\._Checking_File_Readiness_$/ m/_Watched_Folder_\._Active_$/

    cheers

    tachyon

      I didn't see your reply until today. I'm currently using the following, which is working:
      use strict; open OUTPUT, ">c:/temp/warning.txt"; my $mytime=(time); my ($File,$FileStat,$CallOutDir); chdir 'F:\Solimar_Work_Directories\XVTP\XVTP Cluster Feed' or die "Arg +hh!!! $!"; opendir(ROOT, ".") or die "Arghh!!! $!"; foreach $File (readdir(ROOT)) { next if $File=~/^\./; next if ($File eq "_Watched_Folder_._Active_"); next if ($File=~/\._Checking_File_Readiness_$/); next if (-d $File); if ($FileStat = (stat $File)[9]){ if ($FileStat <= ($mytime - 300)) { print "File older than 5min found. The file name is $File"; print OUTPUT "File older than 5min found. The file name is $Fi +le"; last; } } } close OUTPUT;