Learn R Programming

RandomFields (version 2.0.71)

FileExists: Files

Description

The function FileExists checks whether a file or a lock-file exists

The function LockRemove removes a lock-file

Usage

FileExists(file, PrintLevel=RFparameters()$Print)

LockRemove(file)

Arguments

file
name of the data file
PrintLevel
if PrintLevel<=1< code=""> no messages are displayed

Value

  • FileExists returns
  • 1if file already exists
  • 2if file.lock already exists
  • 3if file.lock was tried to be created, but another process inferred and got priority
  • 0otherwise, file and file.lock did not exist and file.lock has been created

Details

FileExists checks whether file or file.lock exists. If none of them exists file.lock is created and hostname and PID are written into file.lock. This is useful if several processes use the same directory. Further, it is checked whether another process has tried to create the same file in the same instance. In this case FileExists returns for at least one of the processes that file.lock has already been created.