I'm trying to write a shell script in which I recursively copy a directory to a USB stick. I need the return value of the copy operation for error-checking purposes. I've tried
cp -a /var/mydir /media/usbdrive
cp -r /var/mydir /media/usbdrive
as well as a few others, but the problem is that I always get errors such as:
Cannot create fifo: /path/to/fifo Operation not permitted
Whilst these are warnings and the copy operation continues, I get a non-successful error code returned from the operation which messes up the error handling in my script. How can I copy recursively and ignore fifos, symlinks, and other entities that are not valid on a FAT32 file system?