Baanboard.com

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

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
35%
Installation Wizard into new VRC
42%
Manual into existing VRC
3%
Manual into new VRC
19%
Total votes: 31

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 13th October 2017, 08:46
pralash pralash is offline
Member
 
Join Date: Feb 2017
Posts: 61
pralash is on a distinguished road
Baan: 9.0 - DB: SQL Server - OS: Windows 2012R2
How to check the particular directory is available or not in the specified path
Baan: Other/Unknown
C/S: None/Unknown

Hi,
I'm new for LN Programming... I want to know that how to find out the particular directory or folder is available or not in the specified path... Can anybody please let me know that how to perform this task.

Thanks in advance,
Regards,
Pralash
Reply With Quote
  #2  
Old 13th October 2017, 11:08
JaapJD's Avatar
JaapJD JaapJD is offline
Guru
 
Join Date: Sep 2002
Location: Netherlands
Posts: 728
JaapJD will become famous soon enoughJaapJD will become famous soon enough
Baan: BaanIV, BaanERP, ERP LN 6.1 - DB: Oracle, SQL Server - OS: Unix, Windows
Function file.stat() or stat.info()
Reply With Quote
  #3  
Old 13th October 2017, 12:32
pralash pralash is offline
Member
 
Join Date: Feb 2017
Posts: 61
pralash is on a distinguished road
Baan: 9.0 - DB: SQL Server - OS: Windows 2012R2
Thank you so much for your reply...
But I could not able to find the specified directory in a path by using file.stat() or stat.info() function... These are only returns the information about the file such as file size etc... So can you please tell me some another function for find out whether the specified directory is available or not in local system....

Regards,
Pralash
Reply With Quote
  #4  
Old 13th October 2017, 13:26
bdittmar's Avatar
bdittmar bdittmar is offline
Guru
 
Join Date: Apr 2002
Location: Germany, 50.584097,8.544078
Posts: 1,639
bdittmar will become famous soon enough
Baan: 2.2/3.1/4c4/LN6.1 FP6/FP9/HiDox - DB: tbase, ms-sql7, oracle10gV1, 11g - OS: HP-UX, W2K3, SLES
dir/file local

Hello,
Code:
Client file access synopsis

long
 client2server() ( string source, string dest, boolean text.mode [, boolean rm.file] [, boolean progress.window] ) 

long
 create.local.directory() ( string dirent ) 

long
 create.local.file() ( string filename ) 

long
 dir.select.dialog.local() ( ref string dirent ) 

long
 get.client.hostname() ( ref string hostname ) 

long
 get.client.ip.address() ( ref string ip.address ) 

string
 get.local.filename() ( ) 

long
 remove.local.directory() ( string dirent ) 

void
 remove.local.file() ( string filename ) 

long
 seq.fstat.local() ( string filename, ref long nr.bytes ) 

long
 seq.open.dialog.local() ( const string defaultname, const string directory, const string filter, ref string filename ) 

boolean
 seq.open.dialog.next() ( ref string filename ) 

long
 seq.saveas.dialog.local() ( const string defaultname, const string directory, const string filter, ref string filename) 

long
 server2client() ( string source, string dest, boolean text.mode [, boolean progress.window] [, boolean read.only] ) 

long
 start.application.local() ( const string commandline, boolean waitFlag, reference long exitCode, [const string verb] ) 

void
Use these functions to perform various operations on client files and other client operations – for example:

to open, read, write to, close, and delete files on a client
to show a file open or directory chooser dialog on a client
to transfer files between client and server
to retrieve client file information
to create and delete directories on a client
to start an application on a client
to retrieve client hostname and IP address
to show a color selection dialog on a client
Note
You can use most of these functions both with the Baan Windows and with the Webtop client. However, some functions are only supported for the Baan Windows client and therefore deprecated.

Regards
__________________
//Bernd
Reply With Quote
  #5  
Old 13th October 2017, 13:33
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,903
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
What exactly are you trying to accomplish with the path? I know we are on unix, but we typically are asking for file names. If they give you a directory - you can always try to create a file in the path - if it works great - if not just give them an error.
__________________
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 14th October 2017, 08:51
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,286
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
Here's a similar thread.

Hope this helps
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #7  
Old 14th October 2017, 09:40
pralash pralash is offline
Member
 
Join Date: Feb 2017
Posts: 61
pralash is on a distinguished road
Baan: 9.0 - DB: SQL Server - OS: Windows 2012R2
Thank a lot for your reply...
Actually I need to create a session for a customization work... In this customization, I have to perform the following task.

1. A new folder would be created in the name of "Test" under the BSE path(C:\ERPLN) if I execute the session in the first time...
2. Then a new file would be created in the name of "sample.txt" under the path like that C:\ERPLN\Test\sample.txt.
3. I need to store some data into that file (sample.txt) from the "table A" .
4. I have created a directory "Test" by using the mkdir function under the BSE path.
5.Then I opened a new file sample.txt by using file.pointer = seq.open(file.name, "w")...
6.I have stored the necessary data into the file by using seq.puts function...
7.Here now I need to check the directory "Test" is available or not... If it is not available then I create this by using mkdir otherwise I have to prompt the message such as "Directory is already exist"...
Hence can you please tell me how to check whether the specified folder is available or not in a particular path....
Sample script:

if isavailable("test") then
message "Already exist"
else
mkdir("test")
endif

Can you please tell me the baan script exact to the script above...
Regards,
Pralash
Reply With Quote
  #8  
Old 14th October 2017, 19:35
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,903
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Well we do not test for the directory. In this example we just try to download a file to the windows client m: drive. If it errors we just create the directory. Notice the coder commented out the piece that gave an error. You could just mkdir the directory everytime - if it exists just skip the error.

Code:
function send.report.to.client(const string src(), const string dest(), const string dest2())
{
        long err, dir

        err = server2client(src, dest, 1)
        if (err) then						|20061025
		dir = create.local.directory("m:\baantmp\")	|20061025
| 		if (dir) then |error 183 must mean it already exists
| 			message("Error %d creating m:\baantmp\", dir)
| 		endif
		err = server2client(src, dest2, 1)		|20061025
		if (err) then					|20061025
		    message("Error %d copying file to PC (may not have permission)", 
			err)
		endif						|20061025
        endif
}
__________________
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
  #9  
Old Yesterday, 07:13
pralash pralash is offline
Member
 
Join Date: Feb 2017
Posts: 61
pralash is on a distinguished road
Baan: 9.0 - DB: SQL Server - OS: Windows 2012R2
Thanks for your information to implementation of my task.

Have a doubt for using the "mkdir" function... I have created a new directory under the path "C:\ERPLN\Test" while execution of first time for my session...
After that I have created a file "data" and stored some another information from the table of baan..

But whenever we execute the session repeatedly, whether the "Test" folder and it contents is overwrite or not?

Can you please clear my doubt.... Thanks...
Regards,
Senthil
Reply With Quote
  #10  
Old Yesterday, 13:37
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,903
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
If the folder exists the mkdir should not over-write it. My best recommendation is to write the code and run in debug mode to see that happens watching each step.
__________________
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
  #11  
Old Yesterday, 14:03
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,286
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
Hi,

Here's a sample. Also, just for your information, mkdir can only be used to create directories on Server and not on client machine. I've added a sample to check if path exists already. Also, the file will be copied to clients temp directory which can be accessed using %TMP% from your Run Command(Windows+R)
Code:
    long fp
    string file(100)
    
    ret = dir.open("${BSE}\Temp") |# Open directory
    if ret > 0 then |# If already exists, do nothing
    else
        mkdir("${BSE}\Temp")  |# If doesn't exists, create it.
        dir.close(ret)
    endif
    
    file = "${BSE}\Temp\Sample.txt"
    fp = seq.open(file,"w+")
    
    |***********WRITE DATA TO FILE******************
    select tcibd001.*
    from tcibd001
    as set with 1 rows
    selectdo
        seq.puts(tcibd001.item,fp)
    endselect
    
    seq.close(fp)
    
    |************ Copy File to Client Machine's default Temp folder**************
    server2client(file,"${TMP}\Sample.txt",true)
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
Sponsored Links
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help, upgrade worfkflow interstage version 7.4, as new Active Directory path. Marina Miscellaneous 0 18th September 2017 20:35
Programming Question mr_suleyman Tools Development 37 11th November 2016 08:14
Undocumented Functions & Variables george7a Tools Development 81 30th September 2015 11:35
Use AFS to create a patch file. Ruskin AFS/DDC/OLE: Function servers 4 24th December 2013 11:22
Worktop default directory path dmcnally Tools Administration & Installation 2 22nd November 2011 08:15


All times are GMT +2. The time now is 04:35.


©2001-2017 - Baanboard.com - Baanforums.com