I have several .env.sample
files in my project directory.
And I want to copy them to the .env
by preserving the relative path.
before
.env.sample
apps
-- app
-- .env.sample
after
.env.sample
.env
apps
-- app
-- .env.sample
-- .env
I already tried something like this:
find . -name .env.sample -exec cp {} $(echo {} | awk -F.sample '{print $1}') \;
But it doesn't work. The second part of the cp
command doesn't work as I expected. Maybe something about the escaping special character is needed.
Any command that could do the job would be appreciated. And I can learn something new about bash if someone can explain what the problem is in my approach.