From 36fb94f74543b969fc0a35a1a0d65130e52377e4 Mon Sep 17 00:00:00 2001 From: scott Date: Wed, 25 May 2016 17:15:55 +0800 Subject: [PATCH] add support __EMPTY__ (for none suffix files ) ,For Windows, Need install Gnuwin32 grep file command,you can download from here: http://gnuwin32.sourceforge.net/packages.html --- vimfiles/tools/shell/bash/update-filelist.sh | 2 +- vimfiles/tools/shell/batch/update-filelist.bat | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/vimfiles/tools/shell/bash/update-filelist.sh b/vimfiles/tools/shell/bash/update-filelist.sh index 9d974336..0aa13fac 100644 --- a/vimfiles/tools/shell/bash/update-filelist.sh +++ b/vimfiles/tools/shell/bash/update-filelist.sh @@ -27,7 +27,7 @@ else find ${FORCE_POSIX_REGEX_1} . -type f -not -path "*/\.*" ${FORCE_POSIX_REGEX_2} -regex ".*\.("${FILE_SUFFIXS}")$" > "${TMP}" if [[ "${FILE_SUFFIXS}" =~ __EMPTY__ ]]; then - find ${FORCE_POSIX_REGEX_1} . -type f -not -path "*/\.*" ${FORCE_POSIX_REGEX_2} -regex ".*\.("${FILE_SUFFIXS}")$" |grep -v "\.\w*$" |xargs -i sh -c 'file="{}";type=$(file $file);[[ $type =~ "text" ]] && echo $file' >> "${TMP}" + find ${FORCE_POSIX_REGEX_1} . -type f -not -path "*/\.*" |grep -v "\.\w*$" |xargs -i sh -c 'file="{}";type=$(file $file);[[ $type =~ "text" ]] && echo $file' >> "${TMP}" fi fi diff --git a/vimfiles/tools/shell/batch/update-filelist.bat b/vimfiles/tools/shell/batch/update-filelist.bat index defa4998..e9543942 100644 --- a/vimfiles/tools/shell/batch/update-filelist.bat +++ b/vimfiles/tools/shell/batch/update-filelist.bat @@ -21,6 +21,9 @@ for /f "delims=" %%a in ('echo %cd%^|%SED_CMD% "s,\\,\\\\,g"') do ( rem process echo ^|- generate %TMP% dir /s /b %FILE_SUFFIXS%|%SED_CMD% "s,\(%CWD_PATTERN%\)\(.*\),.\2,gI" > "%TMP%" +dir /s /b |grep -v "\.\w*$" |%SED_CMD% "s,\(%CWD_PATTERN%\)\(.*\),.\2,gI" > "%TMP2%" +file -f "%TMP2%" |grep "ASCII.*text"|%SED_CMD% "s/;.*$//g" >> "%TMP%" +del "%TMP2%" > nul echo ^|- apply filter rem NOTE: dir /s /b *.cpp will list xxx.cpp~, too. So use gawk here to filter out thoes things.