infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Cloverleaf
Directory Parse TPS to Make Sure File Isn't Being Written to
Lane O'Brien
Hello,
I need to figure out a directory parse proc that checks file size and last modified timestamp. On each iteration, it will check the previous values and if unchanged pick it up and if it's different, then skip it and check again next time.
I am having an issue without the proc where Cloverleaf is picking up the files while they are being written to and it is corrupting the file.
If anyone could help I would be really grateful.
Thank you,
James Lane O'Brien
Find more posts tagged with
Clovertech
Comments
Peter Heggie
Do a search on Directory Parse in this forum - a previous post will have a sample proc you can use. The code reads in an expanded list of files in the specified folder - it includes the file size and date and time. The code compares the file date time with the current date time, and if the difference is greater than X, then that file will be submitted for processing.
Lane O'Brien
So I am pretty new to TCL I have taken the Cloverleaf class but it has been a little bit since then.
I tried running a search before making my post but I didn't see one that I thought would fit my needs. I will look again but if you have the ability to find one easily I would really appreciate it.
Thank you,
James Lane O'Brien
Peter Heggie
ok sure - here is the link to the other article, down towards the bottom is a sample TCL proc that is used as a directory parse proc. There are some helpful facts in there also.
https://usspvlclovertch2.infor.com/forums/topic/want-to-get-date-and-time-from-incoming-file-in-tcl/
Gene Millard
I am able to get this to work using local drives.
Is there something special that needs to be set on the path to get it to work for SFTP?
I get
could not read "pathname here"
[pd :pdtd:ERR /0:oracleItemMaster_99:--/--/---- --:--:--] ..
[pd :pdtd:ERR /0:oracleItemMaster_99:--/--/---- --:--:--] ": no such file or directory'
Gene Millard
Peter Heggie
We do not have the SFTP / secure messaging component of Cloverleaf, so I cannot give you much assistance. But from the output above, it looks like it may be a simple issue of setting the value of the file or folder name variables.
RobertKersemakers
I don't think you can do this with an (S)FTP connection.
With fileset local you can do this as you are using the OS/tcl commands to check the date/time or other attributes of the file that you are about to process. However with (S)FTP you only have the ftp commands and these don't have the option to check date/time of the file.
I hope I'm wrong Though and someone can show me how to do this.
Gene Millard
Thank you for your reply. It would be nice if there was a way to make sure the file was not picked up before it was completely written on SFTP. We are having a problem that some times it picks it up before it is completed and corrupting the file.
Gene Millard
System
Originally posted by Levy Lazarre
Hello, Gene
I believe that what you are trying to accomplish is feasible by simply having the sender sftp the file to Cloverleaf under a temporary name not expected by the Cloverleaf dirparse proc and then use the sftp "rename" command to rename the file to its expected name.
For example, if you are waiting for "file.csv", they could script it as:
put file.csv file.tmp
rename file.tmp file.csv
Because the 'rename' is an atomic operation, you are guaranteed that 'file.csv' is a complete file when it becomes available to Cloverleaf.
Of course, this assumes that your dirparse proc is looking for specific file patterns and the temp name is not one of them. If your proc is not doing that, then you would have to provide a temporary directory to the sender (with appropriate permissions) to put the temporary file and they would then rename it and move it to the final destination at the same time:
rename temp_path/temp_name final_path/final_name
I hope this helps.