I am seeing some unexpected results while copying package files in a shell script. There are two interrelated issues.
I have commands similar to the following in a shell script:
cp -rp path/to/package/file destination/directory
The problem that I am seeing is that sometimes the package is copied as a whole, which is what I want. Other times the package "goes away" and just the contents of the package ends up in the destination/directory. I don't see the pattern which is causing this to happen differently. Specifically, in the shell script, the package is copied as a whole. But when I try the exact command from the terminal, I get only the contents.
- In the shell script, while the package seems to be copied as a whole, it takes a very long time. Like 20 minutes to copy a 17MB file to a USB drive. When I copy the same package via Finder, it copies in about a minute. Then during testing when I rerun the script, it does not take 20 minutes, but just the minute.
These two results are unexpected. I would expect the same result each time, not varying results with the package verses package contents, and the time to run the script.
Any ideas?