Hi coreplayer2
You can run sync as often as you like, it won't hurt anything. Just because you get a command
prompt back after copying a file, doesn't mean it's been completed, it just means the system is
ready for another command, meanwhile your file might still be copying in the background. The
sync command won't return until everything that should be written to discs, has been written, so
don't unplug that thumb drive until sync returns.
sudo find / -iname "MyDir"
You are doing a case insensitive search by using -iname, this will also return Mydir, mydir, etc...
If you want it to be case sensitive, use -name.
Also, until you finalize this script, you might want to comment out those 2>//dev/null statements.
This way you can see the error messages to make sure they are all acceptable.