Alexandru Popovici
Alexandru Popovici

Reputation: 143

cp acting weird on bash script

I'm trying to copy some image files from a folder to another using a bash script which has the following two lines in it [among many others]:

1. cp -r "$source/images/inverted_header/" "$createDirectory/images"
2. cp -r "$source/images/header/" "$createDirectory/images"

The issue is, the first line copies only the image files found inside "inverted_header" to the target folder [ which is the intended behavior] while the second line copies the folder "header" to the target folder...

This happen on Windows. The script was built on a Mac where it works perfect!

What do I do wrong?

Upvotes: 0

Views: 59

Answers (1)

Alexandru Popovici
Alexandru Popovici

Reputation: 143

Correct syntax is:

1. cp -r "$source/images/inverted_header/." "$createDirectory/images"
2. cp -r "$source/images/header/." "$createDirectory/images"

Works like a charm!

Upvotes: 1

Related Questions