File creation between a specific date

General Macro Scheduler discussion

Moderators: JRL, Dorian (MJT support)

Post Reply
Mirdurern
Newbie
Posts: 11
Joined: Mon Sep 27, 2004 5:46 pm

File creation between a specific date

Post by Mirdurern » Wed Oct 27, 2004 1:31 pm

Hello all,

I did a search on the forum and was unable to find an old topic on this.

I would like to go to the HaidProduction director with greater then 3000 main folders. In each main folder there are 4 sub folders. One of the sub-folder are called Modelling. I want to go into that folder and pull out *_ModellingTreeOut.txt file between a specific date of creation. Then I want to write the main folder name and the text file name to another text file. Is this possible to do with Macro Scheduler program or is there an easy way to get this information?

R:\ HaidProduction\Batch10-26-04-CC-Gr5\Modelling\*_ModellingTreeOut.txt
Batch has over 3000 folders in Haidproducation.
Modelling folder is always found in Batch folder.

1508L_ModellingTreeOut.txt - this file always has number then L or R then _ModellingTreeOut.txt as its name.

Thanks
Mike

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 » Wed Oct 27, 2004 2:34 pm

You can try something like this untested outline of a script. Will need to make variable for mm/dd/yyyy that you want.
Let>FolderName=R:\ HaidProduction\Batch10-26-04-CC-Gr5\Modelling
GetFileList>%FolderName%\*_ModellingTreeOut.txt,files
Separate>files,;,file_names

Let>k=0
Repeat>k
Let>k=k+1
GetFileDate>thisdate
If>%thisdate%>mm/dd/yyyy,WriteFile
Until>k,file_names_count

SRT>WriteFile
WriteLN>c:\path\folder\filelist.txt,%FolderName%\file_names_%k%
END>WriteFile
This is just a rough outline to give you some ideas. It will definitely need to be modified.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Lumumba

Post by Lumumba » Wed Oct 27, 2004 7:43 pm

R:\HaidProduction\Batch10-26-04-CC-Gr5\Modelling\*_ModellingTreeOut.txt

Drive\HaidProductionRootFolder\MainFolder\SubFolder\Files
Let>COMSPEC=cmd.exe
Let>MTODay=15
Let>MTOMonth=08

Let>HaidProductionRootFolder=R:\HaidProduction
Let>MainFolderList=C:\HaidProductionBatchFolderIndex.txt
Let>SubFolder=Modelling
Let>OutputFile=C:\HaidProduction\MTOs_%MTODay%%MTOMonth%.txt

Let>RP_WAIT=1
Run Program>%COMPSPEC% /C dir %HaidProductionRootFolder% /A:D /B > %MainFolderList%

Let>k=0

Label>start
Add>k,1
ReadLn>%MainFolderList%,k,MainFolder
If>%MainFolder%=##EOF##,finish
IfFileExists>%HaidProductionRootFolder%\%MainFolder%\%SubFolder%\%MTODay%%MTOMonth%L_ModellingTreeOut.txt,LFile
IfFileExists>%HaidProductionRootFolder%\%MainFolder%\%SubFolder%\%MTODay%%MTOMonth%R_ModellingTreeOut.txt,RFile
Goto>start

Label>RFile
Let>FoundFile=%MTODay%%MTOMonth%R_ModellingTreeOut.txt
Goto>WriteModellingTreeOutIndex

Label>LFile
Let>FoundFile=%MTODay%%MTOMonth%L_ModellingTreeOut.txt

Label>WriteModellingTreeOutIndex
WriteLn>%OutputFile%,result,%MainFolder% - %FoundFile%
Goto>start

Label>finish
MessageModal>Done!
ExecuteFile>%OutputFile%
The smilie in the above code occurs cause the forum isn't able to display DOS' dir argument /A: D correctly (you've to eliminate the space char right from the colon).

Btw: let's get Bob's approval :wink: Eh, untested. :roll:

Lumumba

Post by Lumumba » Wed Oct 27, 2004 7:54 pm

:shock: Guess a CarriageReturnLineFeed (CRLF) would make sense
:wink:
WriteLn>%OutputFile%,result,%MainFolder% - %FoundFile%%CRLF%

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 » Wed Oct 27, 2004 8:14 pm

You da man Lumumba! Another super job :D


Great that you made the time for Mirdurern.

Only two items I would comment on. The first has nothing to do with original problem. Just a suggestion for all Macro Scheduler scripts that need COMSPEC with Run Program> command::

1. Maybe create COMSPEC based on variable:
MidStr>%OS_VER%,1,2,OS
If>%OS%=95,WIN9X,NT

Label>WIN9X
Let>COMSPEC=Command.com
Goto>Start

Label>NT
Let>COMSPEC=Cmd.exe

Label>Start
----------------------

2. Could also consider using Input> to prompt for MTODay, MTOMonth values
--------------------------

I was looking at File Date, and you are using the date within the file name. Don't know if they are the same, but at least he has a few options to consider. And at least your option has some real code vs. outline.

:idea:I think I will send you my own outlines in the future and have you do the coding for me, hmmmmm, GREAT IDEA! :D
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Lumumba

Post by Lumumba » Wed Oct 27, 2004 8:55 pm

@ Bob
1508L_ModellingTreeOut.txt - this file always has number then L or R then _ModellingTreeOut.txt as its name
My assumption was based on that. We use something similar. Its more intuitive for SuperNoobs (those who have disabled the "Details" option in the Explorer :lol: ) But, a good chance that it's complete rubbish :wink:
... between a specific date of creation
I assume you're correct ! 8)
Let>FolderName=R:\ HaidProduction\Batch10-26-04-CC-Gr5\Modelling
I had the idea that your suggestion is limited to that one Main-/BatchFolder. :?:

Mirdurern
Newbie
Posts: 11
Joined: Mon Sep 27, 2004 5:46 pm

Thank you!

Post by Mirdurern » Thu Oct 28, 2004 11:41 am

Thank you all for the great help.

Mirdurern

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