I'm just starting to use Docker, and I'm newbie in bash scripts, but now I need to write bash script that will do next thing:
- I have 2 dirs with some subdirs:
Rtp/
andRtp-[version]/
, I need ifRtp-[version]/
dir exists rename it to theRtp/
and override it's content. [version] - is dynamic number.
My dir structure:
|-- Rtp
|--- subdir 1
|--- subdir 2
|-- Rtp-1.0 (or Rtp-1.6, Rtp-2.7)
|--- subdir 1
|--- subdir 2
- After this I need in the new
Rtp/
dir find specific fileapp.properties
, and change inside of it string:myvar=my value
to stringmyvar=new value
, and do the same thing with 3 more files
I tried this link: http://stackoverflow.com/questions/15290186/…: find . -name 'Rtp-' -exec bash -c 'mv $0 ${0/*/Rtp}' {} \;
The problem that if dir already exists it move one directory into another.
Also I want rename it and not copy because it's big dir, and it can take some time to copy.
Thanks in advance, can you explain please the solution, in order to I will can change in the future if something will be changed.