2009R2 classic| how to check if directory exists in network

Akvile
Member Posts: 3
Hello,
I have a problem, when running codeunit from classic client it checks if in the directory (which is in the network for example \\vision3new\data\) is some files in File system table.
All is good, when network is running, but sometimes when network is down for some reason I get a message
"The network path cannot be found.
This message refers to the file \\vision3new\data\*.*.
The network server may be down, or the path may be invalid."
But I want not to get message, but just write it in the integration log table because now it won't write it in the log.
So I want the error to be recorded in the log table and the work keeps going until network will start (because it could be down just for a couple of minutes).
I tried with EXISTS(EqSetup."Incoming File Directory"+ 'nul'); but it just write in log table that "The operating system cannot find the file \\vision3new\data\nul .
Verify that the drive, directory, and file names are correct." even thought network is running and not down.
I will wait for some thoughts.
Regards,
Akvilė
I have a problem, when running codeunit from classic client it checks if in the directory (which is in the network for example \\vision3new\data\) is some files in File system table.
All is good, when network is running, but sometimes when network is down for some reason I get a message
"The network path cannot be found.
This message refers to the file \\vision3new\data\*.*.
The network server may be down, or the path may be invalid."
But I want not to get message, but just write it in the integration log table because now it won't write it in the log.
So I want the error to be recorded in the log table and the work keeps going until network will start (because it could be down just for a couple of minutes).
I tried with EXISTS(EqSetup."Incoming File Directory"+ 'nul'); but it just write in log table that "The operating system cannot find the file \\vision3new\data\nul .
Verify that the drive, directory, and file names are correct." even thought network is running and not down.
I will wait for some thoughts.
Regards,
Akvilė
0
Answers
-
I used the following code for a batch to import files:
var Name DataType Subtype Length Directory Record File Dir text 1024 Dir := Setup."Incoming File Path" SELECTLATESTVERSION; Directory.SETRANGE(Path,ENVIRON('temp')); IF hDirectory.FINDFIRST THEN; //to be sure that the data is refreshed Directory.SETRANGE(Path,Dir); Directory.SETFILTER(Name, '%1', '*.@XML'); Directory.SETRANGE("Is a file",TRUE); IF Directory.FINDSET(FALSE,FALSE) THEN BEGIN REPEAT //Do your thing with the found file UNTIL Directory.NEXT() is 0;
0 -
Did you tried using from File Management Codeunit - ClientDirectoryExists/ServerDirectoryExists ?Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions