cancel
Showing results for 
Search instead for 
Did you mean: 

Check File existence

Former Member
0 Kudos

Hi,

In my appilcation I need to check if file exist.

In the appication properties i set the

sap.authentication to true.

Altough the file exist when i use the file.exist method i receive false.

Here the code:

String fileName =

("//cellcom_nt/dfs02/Groups3/MIS/SD/Packags_DVLA/old/PKG_COMB_DESC.DNE");

File path = new File(fileName);

String file = path.getName();

String parentPath = path.getParent();

if (path.exists()) {

wdComponentAPI.getMessageManager().reportSuccess(

"===File Exist === " + parentPath + "
" + file);

} else {

wdComponentAPI.getMessageManager().reportSuccess(

"=== File Not Exist === " + parentPath + "
" + file);

}

T.I.A

Yossi

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Authorization must be given to the user sapservice<sid>

for the required directory path.

Yossi

Former Member
0 Kudos

Hi Roelof,

The path is correct.

When i use the windows start->run->file path i see the file.

I use the character "/" instead of "\". the file object know to convert it to "\".

Regards

Yossi

Former Member
0 Kudos

Yossi,

It helps to check if that path is accessible from the server even though you can access the path from "your" system.

Rajit

Former Member
0 Kudos

Hi,

The code seems right.

Are you sure there's not typo? e.g. Packags_DVLA instead of Packages_DVLA

Good luck, Roelof