Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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=RFoptions()$basic$printlevel)
   LockFile(file, printlevel=RFoptions()$basic$printlevel)
   LockRemove(file)

Arguments

file

name of the data file

printlevel

if PrintLevel<=1 no messages are displayed

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.

LockFile is the same as FileExists except that it does not check whether file already exists.

Value

FileExists returns

1

if file already exists

2

if file.lock already exists

3

if file.lock was tried to be created, but another process inferred and got priority

0

otherwise, file and file.lock did not exist and file.lock has been created

Author(s)

Examples

## Not run: 
## the next command checks whether the file 'data.rda'
## or the file 'data.rda.lock' exists. If so, a positive
## value is returned. If not, the file 'data.rda.lock'
## is created and the value 0 returned.
FileExists("data.rda")

## the next command deletes the file 'data.rda.lock'
LockRemove("data.rda")

## End(Not run)

RandomFieldsUtils

Utilities for the Simulation and Analysis of Random Fields

v0.5.3
GPL (>= 3)
Authors
Martin Schlather [aut, cre], Reinhard Furrer [ctb], Martin Kroll [ctb], Brian D. Ripley [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.