Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

User login

Frontpage Sponsor

Main

Poll
How big is your Baan-DB (just Data AND Indexes)
0 - 200 GB
19%
200 - 500 GB
27%
500 - 800 GB
4%
800 - 1200 GB
7%
1200 - 1500 GB
7%
1500 - 2000 GB
12%
> 2000 GB
25%
Total votes: 85

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 13th February 2020, 09:06
Arlina Arlina is offline
Member
 
Join Date: Feb 2019
Posts: 39
Arlina is on a distinguished road
Baan: Infor LN - DB: MSSql - OS: Windows
File Path existence and space availability
Baan: Baan IVc
C/S: None/Unknown

Hi All,

We have created a customized parameter session to maintain server paths.
These paths would be used by other sessions for file extractions.
Now, is there any function in Baan IV (like path.exists()) to check whether the inputted path is actually present and there is some space. (whether the space is sufficient for the file is not required)

Thanks & Regards,
Arlina
Reply With Quote
Sponsored Links
  #2  
Old 13th February 2020, 14:04
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,422
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Not sure about the space, but about all I ever did was check that the directory and file name they gave me existed (using seq.open.local) and using server2client and just checking for an error when downloading to the provided directory in file. Pretty basic I would just check error from the server2client and say something check directory path and confirm you have access. Really nothing fancy.
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #3  
Old 14th February 2020, 05:45
Arlina Arlina is offline
Member
 
Join Date: Feb 2019
Posts: 39
Arlina is on a distinguished road
Baan: Infor LN - DB: MSSql - OS: Windows
Thanks Mark.
But we need to check the file path existence before actually using it.
dir.open() can be helpful.
Checking space availability is still a question though.
Reply With Quote
  #4  
Old 14th February 2020, 06:08
tmannais's Avatar
tmannais tmannais is offline
Senior Member
 
Join Date: Jul 2017
Location: Bangkok, Thailand
Posts: 274
tmannais is on a distinguished road
Baan: LN 10.5, 10.6, 10.7 - DB: MSSQL - OS: Windows
Just an idea for checking space availability, not even a good idea though but I think it might get the job done.

Try creating a dummy file containing dummy data with the size same as the actual data or specifying maximum space requirement.
If the file is created and the content is not missing that means the required space is available; otherwise, it is not.
After that, you can just delete the dummy file and do your thing.

Looks like a bad idea though. Just trying to contribute.
Reply With Quote
  #5  
Old 14th February 2020, 13:11
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,422
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
You can always execute .bat files and write the output to another file. Then read that file into baan. Sample of how you can check freespace - something like this https://stackoverflow.com/questions/...cmd-batch-file. Google for finding a directory. Put those in .bat file (or even build the .bat file in the code) download to the client, execute it, upload the file to the server, read it and check freespace and directory exists.
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #6  
Old 15th February 2020, 10:13
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,399
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
As Mark mentioned, you can write the code to get the free space to your .bat file and execute that bat file using run.prog()



Or just try the following (Assuming you are on Windows Server) -



Code:
ret = run.prog("cmd.exe","/k dir E:\",RP_WAIT,"","E:\Temp\filesize.txt")


The above code will give you an output file named filesize.txt in the specified location which will contain the last line as the Free Space available in the drive mentioned. Now, you can just read this last line of this output file and know the space availability.
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #7  
Old 18th February 2020, 16:47
OmeLuuk's Avatar
OmeLuuk OmeLuuk is offline
Guru
 
Join Date: Mar 2002
Location: The Netherlands
Posts: 1,125
OmeLuuk is on a distinguished road
Baan: Infor LN 6.1 10.2.1 > 10.7 - DB: MS SQL2008 - OS: VM WindowsServer2008R2
To check availability of a path (may be file share), I use the mkdir() function on the path: if it returns 0 the path exist(ed) if positive, it has been created. If negative, it is a no-go zone. Also when no permissions are given on the share.

If you want you can pre-write a file of a specific required size as outlined before with the seq.open() and seq.write() functions (read the return value of the written bytes) and remove the file prior to using the real thing (but this may be ineffective due to the way the filesystem is handling file history...
__________________
Also read Luke 24:4-8
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +2. The time now is 08:46.


©2001-2018 - Baanboard.com - Baanforums.com