diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-05-05 13:45:00 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-05-05 13:45:00 +0300 |
commit | ce011543cc35e38ca14fa1c0595490b8413175e7 (patch) | |
tree | 3775abb1df3d63c5610eb2131512be083c491568 | |
parent | README update (diff) | |
download | linux-home-ce011543cc35e38ca14fa1c0595490b8413175e7.tar.gz linux-home-ce011543cc35e38ca14fa1c0595490b8413175e7.zip |
add sanitize_dos_files_in_dir
-rw-r--r-- | .bashrc | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -241,6 +241,38 @@ sanitize_unix_files() { && ensure_ends_with_unix_newline "$@" } +sanitize_dos_files_in_dir() { + if [ "$#" -lt 1 ]; then + echo "Usage: $FUNCNAME DIRNAME [FILENAME_MASK...]" >&2 + return 1 + fi + local cmd="$( printf 'find %q -type f' "$1" )" + if [ "$#" -gt 1 ]; then + cmd+="$( printf ' %q' '-(' )" + shift + cmd+="$( printf ' -name %q' "$1" )" + shift + local fn_mask + for fn_mask; do + cmd+="$( printf ' -o -name %q' "$fn_mask" )" + done + cmd+="$( printf ' %q' '-)' )" + fi + cmd+=' -print0' + local path + eval "$cmd" | while read -d '' -r path; do + sanitize_dos_files "$path" + done || return $? +} + +sanitize_dos_files_in_dir_nwx() { + local root_dirname='/cygdrive/c/Netwrix Auditor/CurrentVersion-AuditCore-Dev/AuditCore/Sources' + sanitize_dos_files_in_dir \ + "$root_dirname/Configuration" WebAPI*.acinc WebAPI*.acconf || return $? + sanitize_dos_files_in_dir \ + "$root_dirname/Subsystems/PublicAPI" *.cpp *.h || return $? +} + backup_repo() { for repo_path; do local zipname="$( basename "$( realpath "$repo_path" )" )_$( date -u +'%Y%m%dT%H%M%S' ).zip" |