I have a text file that has a list of filenames.Now I want to see if these files are present in a specific folder using bash script. I have no experience in writing bash scripts.So please help me with this
Asked
Active
Viewed 68 times
-3
-
1[Read file line by line](https://stackoverflow.com/questions/10929453/read-a-file-line-by-line-assigning-the-value-to-a-variable) and [Test for file existence](https://stackoverflow.com/questions/40082346/how-to-check-if-a-file-exists-in-a-shell-script/40082454) – sshashank124 Jan 08 '20 at 04:44
-
@GokulNarayanan : You need to say exactly at which point you got stuck, and what you have so far. Think about how you would solve this in a programming language you are familiar to, and then translate the algotithm to bash – user1934428 Jan 08 '20 at 07:25
1 Answers
0
a simple for loop can do what you need :
for file in $(cat yourfilelist.txt); do ls -l /folder/to/check/"$file"; done
for missing files you'd get No such file or directory

nullPointer
- 4,419
- 1
- 15
- 27