Very strange error with EXISTS and File Operations

Hi together! Today i encountered a really strange error. I made a program to check if a file already exists on hdd: IF EXISTS(‘abc.txt’) THEN MESSAGE(‘YES’) ELSE MESSAGE(‘NO’); On my PC it worked fine, but when i tried it on another machine, this code always returned NO, even if the file existed. I tried also another way like: IF FileVar.OPEN(‘abc.txt’) THEN … but this didn’t work too. I have no clue why this happens. I am also logged on the PC as Administrator so missing permissions should not be the problem. Re-Install of Navision didn’t help too. Any ideas??? Thx Stefan

Does it have anything to do with the path of file? In which drive the program has to check ‘abc.txt’?

No, we tried on C: on D: and also with UNC path no difference and it isn’t working only at 1 pc, several other pc’s we tried are working correctly.

Is the file allready open in another program (e.g. Excel)? Is the file write-protected?

@Anfinnur: unfortunally not

Hi, maybe a stupid question, but if you create a form with table 2000000022::FILE and set the filter in ‘PATH’ on your path, is your file visible on the form (on this computer)? Andre

@Andre looks like stupid questions are the best one ;-). We found out that the name of the file was <abc.txt.txt> instead of <abc.txt>, that’s the problem if file endings are not visible. Thx anyway!! PS: Nette Signatur :wink:

quote:


Originally posted by blum
… looks like stupid questions are the best one ;-). …


YEP! [8D]

that’s not directly tied with the problem above, but perhaps an interesting note: I wanted to load a jpg-file from a special folder. The number of jpg-files in this folder was known, but i always got only about the half of this files shown in the file-table (2000000022) when i filtered then name with ‘*.jpg’. At first i couldn’t find a reason for this behaviour. But then i saw that about the half of the extensions are written in upper case and the other half in lower case. When i filtered for both cases every file was found. I didn’t expect navision and windows to have a difference between upper and lower case ?!..

Hi Stefan,

quote:


Originally posted by StefanWeinreich
I didn’t expect navision and windows to have a difference between upper and lower case ?!..


In filters Navision makes always a difference between upper and lower case [;)]. To avoid this problem use always ‘@’ as first sign in the filter (if you want to filter text). Try your filter with: ‘@*.jpg’. bye Andre

thanks Andre, i’ve tried and it works fine. Every day is a day for learning something new…