Edit: aioobe's answer has been updated to show the -e flag, which I did not see when I first answered this. So now I'm just showing an example that includes a directory and how to remove the directory name:
#!/bin/bash
for fn in dir/*
do
shortname=${fn/#*\//}
echo -e "\n$shortname" >> $fn
done
If you need a directory name, remove the line shortname=${fn/#*\//}and replace $ shortname with $ fn in the echo.
source
share