exists
Syntax
exists(path)
Arguments
path is a string or a string vector, indicating the path of a file (or files) or a folder (or folders).
Details
Check if the specified file (or files) or folder (or folders) exists. In the distributed files system, check if the specified folder (or folders) exists.
Examples
t=table(1..10 as ID, rand(1.0, 10) as x);
saveText(t, "C:/DolphinDB/Data/t.txt");
exists("C:/DolphinDB/Data/t.txt");
// output
1
exists("C:/DolphinDB/Data/t1.txt");
// output
0
exists("C:/DolphinDB/Data");
// output
1
exists(["C:/DolphinDB/Data/t.txt","C:/DolphinDB/Data/t1.txt","C:/DolphinDB/Data"]);
// output
[1,0,1]
To check if a folder (or folders) exists in the distributed files system (the following script must be executed at a data node in a cluster):
n=1000000
ID=rand(10, n)
dates=2017.08.07..2017.08.11
date=rand(dates, n)
x=rand(10.0, n)
t=table(ID, date, x)
db = database("dfs://valueDB", VALUE, 2017.08.07..2017.08.11)
pt = db.createPartitionedTable(t, `pt, `date);
pt.append!(t);
exists("dfs://valueDB/20170807");
// output
1