You are viewing limited content. For full access, please sign in.

Question

Question

Detecting if file exist

asked on April 5, 2018

Is there something similar to the follow code below that was written in C# that would be applicable with the Laserfiche SDK.

if(!Directory.Exists(System.IO.Path.GetDirectoryName(movedPath)))
 {
     Directory.CreateDirectory(System.IO.Path.GetDirectoryName(newPath));
 }

My impression is that I will have to perform a search and if the result exist then I can skip over creating the folder path.

0 0

Replies

replied on April 5, 2018

I was able to get around it by using the following

try{
    Folder.Create(repoPath, volumeName, EntryNameOption.None, RASession);
}
catch{
  //Nothing happening here
 }

Not entirely sure if this is the most efficient way to do this.

0 0
replied on April 5, 2018

This is pretty much the way that I've always done it.

0 0
replied on April 5, 2018

You can do something like

FolderInfo CurFolder = (FolderInfo)Entry.TryGetEntryInfo(repoPath, RASession);
if ((CurFolder == null)) {
    // Does not exist so create it
}

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.