I changed my dropbox setup (to save space in the cloud) and the previous links don't work correctly anymore. The scripts are short, so I'll just quote them here:
#!/bin/bash
#
# cat sketch
# DdelV 20131004
#
# simple -- just cat all files in the named directory.
#
if [[ $# -lt 1 ]]
then
echo "Usage $0 [basename of sketch] ..."
exit 1
fi
#
while [[ -d $1 ]]
do
for f in ${1}/*
do
echo "########## $f ############"
cat $f
done
shift
done
and,
#!/bin/bash
# DdelV 20131003
# move (rename) an Arduino sketch
#
# the basename of the sketch is also
# the name of the enclosing folder.
#
# the file extension may be .pde
# or .ino
#
# script exits with status=0 on success
# or 1 incorrect arguments (displays usage text)
# 2 source directory does not exist
# 3 source file not found in source directory (or bad ext)
# 4 creation of new directory failed
# 5 moving of file to newly created directory failed
# 6 unable to remove old directory (not empty?)
# 7 bash error
#
if [[ $# -ne 2 ]]
then
echo "Usage $0 oldname newname"
echo "(best to execute this in ~/sketchbook folder.)"
exit 1
fi
#
# is there a directory by that name?
if [[ -d $1 ]]
then
# yes, carve off any trailing slash
OLDNAME=${1%/}
else
# no, complain and quit.
echo "No directory named $1 found!"
exit 2
fi
#
# okay, file by that name in directory?
if [[ -e $OLDNAME/${OLDNAME}.ino ]]
then
# found it, set extension
EXT=.ino
# how about the obsolete extension?
elif [[ -e $OLDNAME/${OLDNAME}.pde ]]
then
# okay, that's it then (we'll change it, below)
EXT=.pde
else
## debug echo "OLDNAME is $OLDNAME"
# we didn't find it, typo?
echo "No file named ${OLDNAME}.ino or ${OLDNAME}.pde found in $OLDNAME!"
exit 3
fi
#
# note that we DON'T check for existing target,
# mkdir won't complain if target directory exists
# mv won't clobber, though.
#
NEWNAME=$2
if mkdir -p -m 755 $NEWNAME
then
# DO IT!
if mv -v -n ${OLDNAME}/${OLDNAME}$EXT ${NEWNAME}/${NEWNAME}.ino
then
# are there more files to move?
if [[ -e ${OLDNAME}/* ]]
then
# yes, move them.
mv -v -n ${OLDNAME}/* ${NEWNAME}/
fi
# directory ${OLDNAME} should now be empty
# and it can be removed.
if rmdir -v ${OLDNAME}
then
# that went well, let's leave with good status
exit 0
else
echo "Couldn't remove old directory ${OLDNAME}."
exit 6
fi
fi
else
# here if moving sketch failed.
echo "mv $OLDNAME$EXT $NEWNAME.ino failed!"
exit 5
fi
else
# here if creation of new dir failed.
echo "mkdir ${NEWNAME} failed!"
exit 4
fi
# we should never reach this point!
exit 7
Of course, you may want to write a rmsketch.sh script too (left as an exercise for the student)!