Можно на питоне такое сделать
import os
folder = '/home/user/project'
for root, dirs, files in os.walk(folder):
for f in files:
if f.endswith('.pug'):
new_file = f.replace('.pug', '.twig')
os.rename(os.path.join(root, f), os.path.join(root, new_file))