#!/bin/bash cd export ls * | grep -v Book.txt | xargs rm cd .. for old in *.md; do cp $old export/`basename $old .md`.txt; done