Skip to content

Instantly share code, notes, and snippets.

@karancode
Created March 3, 2020 22:29
Show Gist options
  • Select an option

  • Save karancode/017f751a71993bedead78e2872985f2c to your computer and use it in GitHub Desktop.

Select an option

Save karancode/017f751a71993bedead78e2872985f2c to your computer and use it in GitHub Desktop.
Duplicate all the files in a directory with different name (appended string, etc.)
# Let's say you've .yaml.j2 files in a directory and
# you want to make copy for each file, for ex:
# files you have : config1.yml.j2 config2.yml.j2 porperties1.yml.j2 setup.yml.j2
# files you want : config1.yml.j2 config1_new.yml.j2 config2.yml.j2 config2_new.yml.j2 porperties1.yml.j2 porperties1_new.yml.j2 setup.yml.j2 setup_new.yml.j2
for filename in *.yml.j2; do mv $filename ${filename%.yaml.j2}_new.yml.j2; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment