I'm trying to copy all files like this:
...
dialogue022-en.txt
dialogue023-en.txt
dialogue024-en.txt
...
into files like this:
...
dialogue022-pivot.txt
dialogue023-pivot.txt
dialogue024-pivot.txt
...
To perform the copy, simply use:
for i in dialogue*-en.txt; do cp "$i" "${i/-en.txt}"-pivot.txt;done
Or, to see the commands first, use:
for i in dialogue*-en.txt; do echo cp "$i" "${i/-en.txt}"-pivot.txt;done
The part after the slash simply indicates the string that should be substracted from the original filename.
Kudos to https://unix.stackexchange.com/questions/122605/how-do-i-copy-multiple-files-by-wildcard
You can use regular expressions instead with JREN.BAT like this:
jren "^(dialogue-\d*-)en(\.txt)$" "$1pivot$2"
Steps:
cd c:\wheremyfilesare
(or just right click the folder in Windows Explorer while pressing shift and choose to "open command line here")I got to know JREN through dbenham and it works very well.
Warning: this renames the files, so you should copy them first to another folder if you want to keep both files. Just in case, if that forum goes offline I placed the jren code in here for download.