this is a lot more obnoxious than expected. it turns out spacem has a bug when run against a file in a directory, where it cannot do the renaming properly.
the current state is not right yet, but it's better than it was in terms of features. but this needs to work properly for both spacem and spacemall
# makes root user's home directory's permissions right.
define_yeti_alias reroot='chown -R root:root /root'
-# space 'em all fixes naming for all of the files of the appropriate types in the current directory.
-define_yeti_alias spacemall="find . -maxdepth 1 -mindepth 1 -type f \( $(echo pdf png jpg jpeg odt ods docx m4a mp3 eml html mov pptx xlsx zip | sed -e 's/\([a-z0-9][a-z0-9]*\)/-iname \"*.\1\" -o /g') -iname \"*.txt\" \) -exec bash "$FEISTY_MEOW_SCRIPTS/files/spacem.sh" \"{}\" \; "
-#2>> ~/.tmp/zz_spacem.log'
-
# yes, these what/who/why functions are really helpful...
define_yeti_alias whoareyou='echo -e "Hello, I am a computer named $(hostname)\nand I am very pleased to meet you."'
define_yeti_alias whereami='echo whoa dude, try not to think about it...'
##############
+ # space 'em all fixes naming for all of the files of the appropriate types in the directories specified.
+ function spacemall() {
+ local -a dirs=("${@}")
+echo "dirs from params are: " "${dirs[@]}"
+ if [ ${#dirs[@]} -eq 0 ]; then
+echo dirs had zero entries
+ dirs=(.)
+ fi
+echo "dirs are: " "${dirs[@]}"
+
+#was using: -maxdepth 1 -mindepth 1
+ find "${dirs[@]}" -follow -type f \( $(echo pdf png jpg jpeg odt ods docx m4a mp3 eml html mov pptx xlsx zip | sed -e 's/\([a-z0-9][a-z0-9]*\)/-iname \"*.\1\" -o /g') -iname "*.txt" \) -exec bash "$FEISTY_MEOW_SCRIPTS/files/spacem.sh" "{}" \;
+ }
+
+ ##############
+
# site avenger aliases
function switchto()
{
#print "new name='$new_name'\n";
local $intermediate_name = $dir . "RL" . rand() . ".tmp";
#print "\n";
-#print "command A is: rename [$old_name] [$intermediate_name]\n";
-#print "command B is: rename [$intermediate_name] [$new_name]\n";
-#print "\n";
+print "command A is: rename [$old_name] [$intermediate_name]\n";
+print "command B is: rename [$intermediate_name] [$new_name]\n";
+print "\n";
rename($old_name, $intermediate_name)
|| die "failed to do initial rename";
rename($intermediate_name, $new_name)
{
while [ $# -gt 0 ]; do
arg="$1"; shift
+echo "arg is '$arg'"
if [ ! -f "$arg" -a ! -d "$arg" ]; then
echo "=> did not find a file or directory named '$arg'."
continue
intermediate_name="'$arg'"
else
# now zap the first part of the name off (since original name is not needed).
- intermediate_name="$(echo $intermediate_name | sed -e 's/.*=> //')"
+ intermediate_name="$(echo "$intermediate_name" | sed -e 's/.*=> //')"
saw_intermediate_result=1
fi
# first we rename the file to be lower case.
- actual_file="$(echo $intermediate_name | sed -e "s/'\([^']*\)'/\1/")"
- final_name="$(perl $FEISTY_MEOW_SCRIPTS/files/renlower.pl "$actual_file")"
+ actual_file="$(echo "$intermediate_name" | sed -e "s/\'\([^']*\)\'/\1/")"
+ final_name="$(perl "$FEISTY_MEOW_SCRIPTS/files/renlower.pl" "$actual_file")"
local saw_final_result=0
if [ -z "$final_name" ]; then
final_name="$intermediate_name"
else
- final_name="$(echo $final_name | sed -e 's/.*=> //' )"
+ final_name="$(echo "$final_name" | sed -e 's/.*=> //' )"
saw_final_result=1
fi
#echo intermed=$saw_intermediate_result