Need bash shell script that will loop through /mnt and check if file exists on any of the drives
Posted on 2010-09-09
I need a simple bash shell script that will check if a file exists on any of the attached hard drives. Then it will dump a list of the drive paths with a * next to any that have this file.
The text file should look like this, with the * being the drive with the file we checked for:
The file name is source and will always be at the root of the drive. We do not need to read the contents of the file, just need to know if it exists.
Here is what I have so far, pretty much nothing:
ls /mnt > drive_list.txt
Just not sure how to check if the file exists