From ce011543cc35e38ca14fa1c0595490b8413175e7 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 5 May 2016 13:45:00 +0300 Subject: add sanitize_dos_files_in_dir --- .bashrc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.bashrc b/.bashrc index 0e2cea8..d469dfa 100644 --- a/.bashrc +++ b/.bashrc @@ -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" -- cgit v1.2.3