Is there a file in that folder?

August 12, 2014 | By More

If you need a script to find if there is a file in a folder or perhaps you are checking for the existence of a file in a specific location.



#!/bin/bash
FILE=”/DIRECTORY/FILENAME”
if [ -f $FILE]; then
echo “Yep that file is there
else
echo “Oh no file with that name found”
fi
exit

Sorted.

Tags:

Category: Coding

About the Author ()

Comments are closed.