X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Ffiles%2Fremove_here_if_not_there.sh;h=ba0d8dff1fff4d8e37edc929d5612911eb4c72b5;hb=7aa39ad678cbcbdc638e03a2b0c50818eb8850f6;hp=6ba6a4e3f0dd1f46d7862101a4636114becc4857;hpb=68af7b9ccb4b623e40115f4f77e010f8687d7535;p=feisty_meow.git diff --git a/scripts/files/remove_here_if_not_there.sh b/scripts/files/remove_here_if_not_there.sh index 6ba6a4e3..ba0d8dff 100644 --- a/scripts/files/remove_here_if_not_there.sh +++ b/scripts/files/remove_here_if_not_there.sh @@ -3,8 +3,13 @@ function print_instructions() { echo -e "\n$(basename $0 .sh):\n" + +#hmmm: extract to a terminal size function. +# calculate the number of columsn in the terminal. +cols=$(stty size | awk '{print $2}') + echo -e 'this script takes two parameters, a "here" folder and a "there" folder, almost as if it were a copy command. but instead, this removes any file from under the "here" location if it cannot be found in the "there" location. so the "there" location is considered a more definitive template of what should be in "here", such that we strip out what "there" does not have.\n\n -the most" useful way to use this script is for a "here" hierarchy that is a copy of an older version of another "there" hierarchy. the "there" hierarchy may have changed a lot, including new files, changed files, and deleted files. it is a simple operation to copy everything from "there" into "here" (such as by using the command [ cp -R "$there"/* "$here" ] ) , but it is a lot harder to determine what stuff in "here" is out of date and should be removed. that is where this script comes in; it can be run to flush out any older things in "here", rather than requiring the user to manually find all those files. ' | splitter +the most" useful way to use this script is for a "here" hierarchy that is a copy of an older version of another "there" hierarchy. the "there" hierarchy may have changed a lot, including new files, changed files, and deleted files. it is a simple operation to copy everything from "there" into "here" (such as by using the command [ cp -R "$there"/* "$here" ] ) , but it is a lot harder to determine what stuff in "here" is out of date and should be removed. that is where this script comes in; it can be run to flush out any older things in "here", rather than requiring the user to manually find all those files. ' | splitter --maxcol $(($cols - 1)) echo echo "Example Usage:" echo