What is the command to copy a file from a directory to another directory in macOS?
You need to protect any whitespace in the names with either "" or \

cp foo 'path/with spaces/to/target'
cp foo path/with\ spaces/to/target


Additionally


Using Tab Completion in bash and other shells will automatically insert \ where necessary
Drag&amp;drop of a file/directory from Finder into a Terminal window will insert the full path of said file/directory, with appropriate escapes
ditto is an alternative to cp which is better at handling metadata, resource forks and other specialities of macOS-specific filesystems. 
If you want/need to use environment variables as part of a path (path/to/$TARGET/directory), use "" instead of '' but look out for $ as part of directory/file names