Forked from HelenaEksler/check-files-exist-from-list.sh
Created
August 9, 2018 19:48
-
-
Save AruniRC/2b4639818aaac17d584a7233c5bae4f0 to your computer and use it in GitHub Desktop.
Bash script to check files in list exist in directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#Check Files in list from file exist or doesn't exist in directory. | |
if [ $# -eq 0 ] || [ $# -eq 1 ] | |
then | |
echo "You must pass the path to file with the list and the path to directory to check files. \nsh check-file-exist-from-list.sh path/to/file path/to/directory" | |
exit 1 | |
fi | |
while read -r file; do | |
if [ -e "$2/$file" ]; then | |
echo "$file exists in $2" | |
else | |
echo "$file doesn't exist in $2" | |
fi | |
done < "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment