In bash, I have a script that a uses while loop to copy files in a certain folder to various different directories. After each file is copied, I've written
mv $dir/$file $dir/_$file
_ in the file's prefix to mark that it's been copied. (
$dir is where the files are copied from.) At the end of the loop, the script lists the unmarked files to show which ones have not been copied.
I came across a small conflict where some files get copied more than once to different directories, but it cannot copy the file again because its name has been changed.
I was thinking of using
if [ $file -eq $dir/_$file ] but no good.
What's a simple way to check a directory for
If there is a better method of doing all of this, that would be swell.