From: Chris Koeritz Date: Tue, 12 Feb 2013 20:26:13 +0000 (-0500) Subject: fixed inconsistent naming on change_endings, tossed out old script for finding bad X-Git-Tag: 2.140.90~1112 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=a24e87eb5df257887924bd690796ce1f7fdab025;p=feisty_meow.git fixed inconsistent naming on change_endings, tossed out old script for finding bad protection on files, fixed up recursive renlower paths. --- diff --git a/scripts/files/change_endings.pl b/scripts/files/change_endings.pl deleted file mode 100644 index 97945e16..00000000 --- a/scripts/files/change_endings.pl +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/perl - -############################################################################### -# # -# Name : change endings # -# Author : Chris Koeritz # -# Rights : Copyright (C) 2002-$now by Author # -# # -# Purpose: # -# # -# Replaces all of the endings on files in the current directory with # -# a different ending. The first parameter should be the old ending and the # -# second parameter should be the new ending. # -# # -############################################################################### -# This script is free software; you can redistribute it and/or modify it # -# under the terms of the GNU General Public License as published by the Free # -# Software Foundation; either version 2 of the License or (at your option) # -# any later version. See "http://www.fsf.org/copyleft/gpl.html" for a copy # -# of the License online. Please send any updates to "fred@gruntose.com". # -############################################################################### - -# change_endings: takes all of the files in the current directory ending in $1 -# and modifies their suffix to be $2. - -require "filename_helper.pl"; - -local($first) = $ARGV[0]; -local($second) = $ARGV[1]; - -#print "parms are: $first and $second \n"; - -if ( !length($first) || !length($second) ) { - print "change_endings: requires two parameters--the old suffix to look for in this\n"; - print "directory and the new suffix (without dots) to change the old suffix to.\n"; - exit 0; -} - -foreach $filename (&glob_list("./*$first")) { -#old print "file=$filename\n"; -#old local($ext_temp) = &extension($filename); -#old print "ext is: $ext_temp\n"; -#old local($no_ext) = &non_extension($filename); -#old print "cmd is: mv \"$filename\" \"$no_ext$second\"\n"; -#old system("mv \"$filename\" \"$no_ext$second\""); - - local $new_name = $filename; - $new_name =~ s/$first/$second/g; -#print "old name $filename\n"; -#print "new name would be $new_name\n"; - - system("mv \"$filename\" \"$new_name\""); -} - - diff --git a/scripts/files/change_suffix.pl b/scripts/files/change_suffix.pl new file mode 100644 index 00000000..97945e16 --- /dev/null +++ b/scripts/files/change_suffix.pl @@ -0,0 +1,55 @@ +#!/usr/bin/perl + +############################################################################### +# # +# Name : change endings # +# Author : Chris Koeritz # +# Rights : Copyright (C) 2002-$now by Author # +# # +# Purpose: # +# # +# Replaces all of the endings on files in the current directory with # +# a different ending. The first parameter should be the old ending and the # +# second parameter should be the new ending. # +# # +############################################################################### +# This script is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; either version 2 of the License or (at your option) # +# any later version. See "http://www.fsf.org/copyleft/gpl.html" for a copy # +# of the License online. Please send any updates to "fred@gruntose.com". # +############################################################################### + +# change_endings: takes all of the files in the current directory ending in $1 +# and modifies their suffix to be $2. + +require "filename_helper.pl"; + +local($first) = $ARGV[0]; +local($second) = $ARGV[1]; + +#print "parms are: $first and $second \n"; + +if ( !length($first) || !length($second) ) { + print "change_endings: requires two parameters--the old suffix to look for in this\n"; + print "directory and the new suffix (without dots) to change the old suffix to.\n"; + exit 0; +} + +foreach $filename (&glob_list("./*$first")) { +#old print "file=$filename\n"; +#old local($ext_temp) = &extension($filename); +#old print "ext is: $ext_temp\n"; +#old local($no_ext) = &non_extension($filename); +#old print "cmd is: mv \"$filename\" \"$no_ext$second\"\n"; +#old system("mv \"$filename\" \"$no_ext$second\""); + + local $new_name = $filename; + $new_name =~ s/$first/$second/g; +#print "old name $filename\n"; +#print "new name would be $new_name\n"; + + system("mv \"$filename\" \"$new_name\""); +} + + diff --git a/scripts/files/find_bad_protection.sh b/scripts/files/find_bad_protection.sh deleted file mode 100644 index b9add8fc..00000000 --- a/scripts/files/find_bad_protection.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -source "$FEISTY_MEOW_SCRIPTS/core/functions.sh" - -bad_file="$HOME/bad_protections.txt" -if [ $# = 0 ]; then dirname=$HOME; export dirname; -else dirname=$1; export dirname; fi - -echo "Searching for bad file protections in $dirname..." -echo "This includes any files that are writable by other or that have the" -echo "SetUID or SetGID bits turned on." - -echo "Bad file modes and owners report for $(date_stringer)." >$bad_file -echo "" >>$bad_file - -export outfile="$(mktemp "$TMP/zz_badprot.XXXXXX")" - -echo "These files have bad modes:" >>$bad_file -find "$dirname" -type f -exec ls -AlF {} ';' >$outfile -cat $outfile | - sed -n -e '/^.....w/p - /^........w/p - /^..s.../p - /^.....s/p' | - grep '^[^l]' >>$bad_file -rm $outfile -echo "" >>$bad_file - -echo "These directories have bad modes:" >>$bad_file -find "$dirname" -type d -exec ls -Ald {} ';' >$outfile - -#this is same as above block. make it a function. -cat $outfile | - sed -n -e '/^.....w/p - /^........w/p - /^..s.../p - /^.....s/p' | - grep '^[^l]' >>$bad_file -rm $outfile -# - -echo "Searching for Files Not Owned by the User in $HOME...." -echo "" >>$bad_file -bash $FEISTY_MEOW_SCRIPTS/find_non_owned.sh $HOME >>$bad_file - -echo "" >>$bad_file -echo "" >>$bad_file - -echo $(basename $0) " is finished. Showing report from $bad_file" - -less $bad_file - -#optional: rm $bad_file - diff --git a/scripts/files/recursive_renlower.sh b/scripts/files/recursive_renlower.sh index 4d3f68de..b4ea3c79 100644 --- a/scripts/files/recursive_renlower.sh +++ b/scripts/files/recursive_renlower.sh @@ -2,6 +2,6 @@ #need to support multiple names. for i; do #old find "$1" -type d -depth -print -exec perl $FEISTY_MEOW_SCRIPTS/renlower.pl {}/* ';' - find "$i" -depth -exec perl $FEISTY_MEOW_SCRIPTS/renlower.pl "{}" ';' + find "$i" -depth -exec perl $FEISTY_MEOW_SCRIPTS/files/renlower.pl "{}" ';' done