File Manipulation
From EpixStudios
Counting the number of files in a directory and all sub-directories:
ls -laR | wc -l
Removing the first few characters from a file name ('old' in this case):
for x in old*.pdf; do echo `basename $x` | sed -e 's/...//' ; done for x in old*.pdf; do y=`echo \`basename $x\` | sed -e 's/...//'`; echo $x $y; done for x in old*.pdf; do y=`echo $x | sed -e 's/...//'`; echo $x $y; done for x in old*.pdf; do y=`echo $x | sed -e 's/...//'`; mv $x $y; done
Adding characters to a file name whilst preserving the correct file extension:
for x in *.pdf; do y=`basename $x .pdf`; mv $x ${y}_map.pdf; done

