##linux determines whether the file exists
1. Use the ls command to determinels -l /home/admin/test.txt # 查看/home/admin/目录下test.txt文件信息,不存在则报错
find /home -name "test.txt" # 在/home目录及其子目录下查找test.txt文件,不存在则无输出
#文件存在则删除 if [ ! -f "/data/test.txt" ];then echo "文件不存在" else echo "文件存在" fi
The above is the detailed content of Linux determines whether a file exists. For more information, please follow other related articles on the PHP Chinese website!