IFFileChanged error in 19xx

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Guest

IFFileChanged error in 19xx

Post by Guest » Sun Nov 10, 2002 6:03 pm

I have just discovered that I am getting incorrect results when using IfFileChanged command comparing dates from 19xx. Perhaps it may be a Y2K problem using a 2 digit year vs. a 4 digit year? I am using MacroScheduler 7.0vb with Windows 98SE. Dates are formatted for 4 digit years.
=================================
Brief explanation using the command like this to copy files changed in the last day:

Label>NextFile
IfFileChanged>Filename,NextFile
...
...
Label>CopyFile
CopyFile>...
...
...
...
If>NotDone,NextFile

Label>End

=============================
The problem is that if the filedate is in 19xx, then it is identified as "Changed" and is processed to be copied.

Additional technical information follows here, probably not needed to validate the problem and make a correction.

Here is an heavily edited portion of my log showing about 7 files. Five files are not copied, but two are, when they should not be. The file name is read in from a text file of the directory and you can see the file date on the MidStr> command line just below the Label>ProcessFile. You can also see that if the file is in 19xx, that it is copied while those in 20xx just go to next line as intended.

====Sample from log file starts here =============

11/10/2002 11:14:45:520 - Label>ProcessFile
11/10/2002 11:14:45:520 - MidStr>TAKEOVER DOC 22,016 08-16-2002 12:07p TAKEOVER.doc,47,60,FileName
11/10/2002 11:14:45:630 - IfFileChanged>J:\COMMON\TAKEOVER.doc,NextLine[/color]
11/10/2002 11:14:45:690 - Let>LineNo=9+1
11/10/2002 11:14:45:690 - Let>Done=6+1
11/10/2002 11:14:45:910 - Message>Total Files processed = 6.
Total Files Copied = 0.
Last file copied was
J:\COMMON\ .

11/10/2002 11:14:46:560 - Label>ProcessFile
11/10/2002 11:14:46:620 - MidStr>CASELOAD 41,978 11-04-2002 4:20p CASELOAD,47,60,FileName
11/10/2002 11:14:46:730 - IfFileChanged>J:\COMMON\CASELOAD,NextLine[/color]
11/10/2002 11:14:46:780 - Let>LineNo=10+1
11/10/2002 11:14:46:780 - Let>Done=7+1
11/10/2002 11:14:46:950 - Message>Total Files processed = 7.
Total Files Copied = 0.
Last file copied was
J:\COMMON\ .

11/10/2002 11:14:47:660 - Label>ProcessFile
11/10/2002 11:14:47:660 - MidStr>CASELOAD DOC 46,080 11-04-2002 4:44p caseload.doc,47,60,FileName
11/10/2002 11:14:47:770 - IfFileChanged>J:\COMMON\caseload.doc,NextLine[/color]
11/10/2002 11:14:47:830 - Let>LineNo=11+1
11/10/2002 11:14:47:880 - Let>Done=8+1
11/10/2002 11:14:48:050 - Message>Total Files processed = 8.
Total Files Copied = 0.
Last file copied was
J:\COMMON\ .

11/10/2002 11:14:48:710 - Label>ProcessFile
11/10/2002 11:14:48:760 - MidStr>WPAJK{PJ 1 1,523 05-04-2000 11:58a WPAJK{PJ.1,47,60,FileName
11/10/2002 11:14:48:870 - IfFileChanged>J:\COMMON\WPAJK{PJ.1,NextLine[/color]
11/10/2002 11:14:48:930 - Let>LineNo=12+1
11/10/2002 11:14:48:930 - Let>Done=9+1
11/10/2002 11:14:49:090 - Message>Total Files processed = 9.
Total Files Copied = 0.
Last file copied was
J:\COMMON\ .

11/10/2002 11:14:49:810 - Label>ProcessFile
11/10/2002 11:14:49:810 - MidStr>MASSMA~1 DOC 35,328 10-28-1999 3:46p MassMailing102799.doc,47,60,FileName
11/10/2002 11:14:49:920 - Label>CopyNewFile
11/10/2002 11:14:49:970 - Let>Copied=1+1
11/10/2002 11:14:49:970 - Let>LastFile=MassMailing102799.doc
11/10/2002 11:14:50:080 - Message>Total Files processed = 9.
Total Files Copied = 1.
Copying new copy of
J:\COMMON\ MassMailing102799.doc.
11/10/2002 11:14:50:350 - CopyFile>J:\COMMON\MassMailing102799.doc,S:\Backup\COMMON\MassMailing102799.doc
11/10/2002 11:14:50:410 - Label>NextLine
11/10/2002 11:14:50:410 - Let>LineNo=13+1
11/10/2002 11:14:50:460 - Let>Done=10+1
11/10/2002 11:14:50:630 - Message>Total Files processed = 10.
Total Files Copied = 1.
Last file copied was
J:\COMMON\ MassMailing102799.doc.

11/10/2002 11:14:51:290 - Label>ProcessFile
11/10/2002 11:14:51:340 - MidStr>MASSMA~2 DOC 33,792 10-28-1999 3:46p MassMailing102799a.doc,47,60,FileName
11/10/2002 11:14:51:450 - Label>CopyNewFile
11/10/2002 11:14:51:450 - Let>Copied=2+1
11/10/2002 11:14:51:510 - Let>LastFile=MassMailing102799a.doc
11/10/2002 11:14:51:670 - Message>Total Files processed = 10.
Total Files Copied = 2.
Copying new copy of
J:\COMMON\ MassMailing102799a.doc.
11/10/2002 11:14:51:950 - CopyFile>J:\COMMON\MassMailing102799a.doc,S:\Backup\COMMON\MassMailing102799a.doc
11/10/2002 11:14:51:950 - Label>NextLine
11/10/2002 11:14:52:000 - Let>LineNo=14+1
11/10/2002 11:14:52:000 - Let>Done=11+1
11/10/2002 11:14:52:110 - Message>Total Files processed = 11.
Total Files Copied = 2.
Last file copied was
J:\COMMON\ MassMailing102799a.doc.

11/10/2002 11:14:52:770 - Label>ProcessFile
11/10/2002 11:14:52:830 - MidStr>MAVIS11 EXE 1,310,720 06-28-2000 11:34a Mavis11.exe,47,60,FileName
11/10/2002 11:14:52:940 - IfFileChanged>J:\COMMON\Mavis11.exe,NextLine[/color]
11/10/2002 11:14:52:990 - Let>LineNo=15+1
11/10/2002 11:14:52:990 - Let>Done=12+1
11/10/2002 11:14:53:210 - Message>Total Files processed = 12.
Total Files Copied = 2.
Last file copied was
J:\COMMON\ MassMailing102799a.doc.

====Sample from log file ends here =============


This routine is to make a backup all modified files in a folder and all of its sub folders. It also displays an ongoing status message while processing. I was going to submit the finished script to the Macro Scheduler library when completed, but cannot do that yet.

====Original script file starts here =============

Let>SourceDrive=J:
Let>DestinationDrive=S:
Let>LineNo=0
Let>Done=0
Let>Copied=0
Let>LastFile=
Let>CF_OVERWRITE=1

Change Directory>%SourceDrive%\Common
//Next line not tested yet. Treelist.txt file generated in DOS for testing. Actual file will be over 35000 files to review.
//Run Program>dir /4 /s > c:\temp\treelist.txt

Label>NextLine
Let>LineNo=%LineNo%+1
Let>Done=%Done%+1
Message>Total Files processed = %Done%.%CRLF%%CRLF%Total Files Copied = %Copied%.%CRLF%%CRLF%Last file copied was%CRLF%%LastFile%.
//Next line is to limit this test to first 200 lines of treefile.txt
If>LineNo>200,End
ReadLn>c:\temp\treelist.txt,%LineNo%,ThisLine

//Check for file found
If>%ThisLine%=##NOFILE##,Errors

//Check for end of list
If>%ThisLine%=#EOF#,End

//Check for blank lines
If>%ThisLine%=,NextLine

//Check for volume line
MidStr>%ThisLine%,2,15,InLine
If>InLine=Volume in drive,NextLine

//Check for Directory Path
MidStr>%ThisLine%,1,12,InLine
If>InLine=Directory of,GetPath

//Check for lines with Directories
MidStr>%ThisLine%,16,5,InLine
If>InLine=,NextLine

//Check for summary lines
MidStr>%ThisLine%,12,7,InLine
If>InLine=file(s),NextLine

Label>ProcessFile
MidStr>%ThisLine%,47,60,FileName
//FileDate>%SourceDrive%\%Path%\%FileName%,NewDate
//FileDate>%DestinationDrive%\Backup\%Path%\%FileName%,OldDate
//If>OldDate=File Not Found,CopyNewFile
//If>%NewDate%>%OldDate%,CopyNewFile,NextLine
IfFileChanged>%SourceDrive%\%Path%\%FileName%,NextLine

Label>CopyNewFile
Let>Copied=%Copied%+1
Let>LastFile=%SourceDrive%\%Path%\%FileName%
Message>Total Files processed = %Done%.%CRLF%%CRLF%Total Files Copied = %Copied%.%CRLF%%CRLF%Copying new copy of%CRLF%%SourceDrive%\%Path%\ %FileName%.
CopyFile>%SourceDrive%\%Path%\%FileName%,%DestinationDrive%\Backup\%Path%\%FileName%
Goto>NextLine

Label>GetPath
MidStr>%ThisLine%,17,30,Path
Let>LineNo=%LineNo%+3
Goto>NextLine

Label>Errors
Message>Error processing file. Process not completed.

Label>End
Message>Stopped after Line %LineNo%
====Original script file ends here =============

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sun Nov 10, 2002 6:11 pm

:oops: I just realized that I was not logged in when I submitted this item for review. Just wanted to make sure I got the blame properly.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Nov 14, 2002 3:19 pm

:!: :!: Since it was unusual not to see a reply withn 5 days, I have resubmitted this item as a new topic under the name If File Changed error.

:idea: (When Tech Support can provide a response, perhaps they will merge both of these topics so only one needs to be followed?)

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts