If a file exists then do (something) in bash
If you need to determine in a file exists in a directory use the first example. Credit to http://stackoverflow.com/questions/638975/how-do-i-tell-if-a-file-does-not-exist-in-bash for a simple answer. #!/bin/bash if [ -f path/to/file.txt ] then echo “file exists” fi If you need to know if it does not exist use this: #!/bin/bash if [ ! -f path/to/file.txt ] then echo “file […]