본문 바로가기
Development

Check Files in list from file exist or doesn't exist in directory

by 오늘만, 2020. 11. 9.
반응형
#!/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](http://check-file-exist-from-list.sh/) path/to/file path/to/directory"
exit 1
fi

while read -r file; do
echo "$2$file"
if [ -e "$2/$file" ]; then
echo "$file exists in $2"
else
echo "$file doesn't exist in $2"
fi
done < "$1"
반응형

'Development' 카테고리의 다른 글

[Linux] How to install vim  (0) 2021.01.04
[Linux] How to remote transfer files  (0) 2021.01.04
.gitignore reset  (0) 2020.12.02
Get total files size from a file list  (0) 2020.11.10
How to install mcrypt to PHP 7.2 on CentOS 7  (0) 2020.10.29