-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete_from
executable file
·69 lines (57 loc) · 2.35 KB
/
delete_from
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
#!/bin/bash
#
# @author Zeus Intuivo <[email protected]>
#
THISSCRIPTNAME=`basename "$0"`
if [[ -z "$1" ]] ; then # empty value
echo "
Deletes Directories in a recursive way.
${THISSCRIPTNAME} from_path
"
exit 0
fi
load_execute_command(){
local provider="file://$HOME/_/clis/execute_command_intuivo_cli/execute_command"
[ ! -d "$HOME/_/clis/execute_command_intuivo_cli/" ] && provider="https://raw.githubusercontent.com/zeusintuivo/execute_command_intuivo_cli/master/execute_command"
local EXECOMCLI=$(curl $provider 2>/dev/null ) # suppress only curl download messages, but keep curl output for variable
eval """${EXECOMCLI}"""
( ( ! command -v passed >/dev/null 2>&1; ) && echo -e "\n \n ERROR! Loading execute_command \n \n " && exit 130; )
} # end function load_execute_command
load_execute_command
delete_with_subfolders() {
local FROMPATH="${1}"
anounce ${orange209} Delete Batch ${FROMPATH}
# sed -i -e s"$SEEKING""$IMPLACING"g sed -e "$FROMPATH"d sed 's@http://www.velophil.de@@' sed -e s"$FROMPATH"g
# --exclude=.DS_Store \
# --exclude=.git \
# --exclude=.idea \
# --exclude=apps/kx/cache \
# --exclude=apps/oauthserver/cache \
# --exclude=docker \
# --exclude=qa \
# --exclude=build \
# --exclude=.dir_bash_history \
all_files=$(find "$FROMPATH" -maxdepth 1 | sed s"$FROMPATH"/g | sed 's/\.\///g' | sed '/^\.$/d' )
#anounce Found:"${all_files}"
#exit
while read -r one_item; do
{
if [ ! -z "${one_item}" ] && [[ "${FROMPATH}/${one_item}" != "${FROMPATH}/${FROMPATH}" ]]; then
{
local filename=$(escape_filename <<< "${FROMPATH}/${one_item}")
anounce "${orange209}${filename}${reset}"
if [ -d "${filename}/" ] ; then
{
anounce_command delete_with_subfolders "${filename}" # recursion inside the folder
}
fi
# onces out then also delete the folder
anounce ${lightblue} rm -rf "${filename}"
rm -rf """${filename}"""
}
fi
}
done <<< "${all_files}"
}
delete_with_subfolders "${1}"