rename FONPATH to ROOTPATH; add git-ignore-find2copy.sh

This commit is contained in:
Luk 2024-01-28 09:50:54 +08:00
parent d016571ff5
commit 304d2564fa
18 changed files with 380 additions and 329 deletions

73
git-ignore-find2copy.bat Normal file
View File

@ -0,0 +1,73 @@
@echo off
@REM 首先清除可能残留的变量
set ROOTPATH=
set ROOTPATH1=D:\faronear
set ROOTPATH2=C:\faronear
set ROOTPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" (
set ROOTPATH=%1
) else (
echo *** Testing Path [[%ROOTPATH1%]] [[%ROOTPATH2%]] [[%ROOTPATH3%]]
if exist "%ROOTPATH1%" (
set ROOTPATH=%ROOTPATH1%
) else if exist "%ROOTPATH2%" (
set ROOTPATH=%ROOTPATH2%
) else if exist "%ROOTPATH3%" (
set ROOTPATH=%ROOTPATH3%
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter [start path] or [leave blank] for default to [[%CD%]]
set /p ROOTPATH=">>> "
echo;
if "" == "%ROOTPATH%" (
set ROOTPATH=%CD%
)
)
)
if not exist "%ROOTPATH%" (
echo ××× [[%ROOTPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ ROOTPATH = [[%ROOTPATH%]]
)
pushd %ROOTPATH%
echo *** Starting from [[%CD%]] ***
echo;
echo === Enter [path to .gitignore] or [leave blank] for default to [[%CD%]]
set /p IGNOREPATH=">>> "
echo;
if "" == "%IGNOREPATH%" (
set IGNOREPATH=%CD%
)
if not exist "%IGNOREPATH%" (
echo ××× [[%IGNOREPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ IGNOREPATH = [[%IGNOREPATH%]]
)
for /d /r %%r in (*) do (
@REM @ if not "%%r" == ".vscode" (
echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || (
if exist "%%r\.gitignore" (
pushd "%%r"
echo ---- updating .gitignore in [[%%r]] ----
copy %IGNOREPATH%\.gitignore %%r\
echo;
popd
)
)
)
popd
:END
pause

48
git-ignore-find2copy.sh Normal file
View File

@ -0,0 +1,48 @@
#!/bin/bash
if [ -d "$1" ]
then
ROOTPATH=$1
else
echo ""
echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " ROOTPATH
echo ""
if [ ! "$ROOTPATH" ]
then
ROOTPATH=`pwd`
fi
fi
if [ ! -d "$ROOTPATH" ]
then
echo "××× [[$ROOTPATH]] not exist! Exit now. ***"
exit
else
echo "√√√ ROOTPATH = [[$ROOTPATH]]"
fi
echo "=== Enter [path to .gitignore]"
read -p ">>> " IGNOREPATH
echo ""
if [ ! -f "$IGNOREPATH/.gitignore" ]
then
echo "××× Not found [[$IGNOREPATH/.gitignore]]. Exit now..."
exit
fi
cd $ROOTPATH
echo "*** Starting from [[`pwd`]] ***"
echo ""
find . -mindepth 1 -maxdepth 3 -type d -name '[^.]*' | grep -E -v 'node_modules|uni_modules|\.deploy_git|\.git|.svn|\.vscode|\.wrangler|unpackage|_webroot|_logstore|_datasotre|_archive|_filestore|_ssl' | while read repo
do
if [ -d "$repo/.git" ]
then
echo "---- updating .gitignore in [[$repo]] ----"
cp $IGNOREPATH/.gitignore $repo/
echo ""
fi
done
cd -

View File

@ -1,73 +0,0 @@
@echo off
@REM 首先清除可能残留的变量
set FONPATH=
set FONPATH1=D:\faronear
set FONPATH2=C:\faronear
set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" (
set FONPATH=%1
) else (
echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]]
if exist "%FONPATH1%" (
set FONPATH=%FONPATH1%
) else if exist "%FONPATH2%" (
set FONPATH=%FONPATH2%
) else if exist "%FONPATH3%" (
set FONPATH=%FONPATH3%
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter [start path] or [leave blank] for default to [[%CD%]]
set /p FONPATH=">>> "
echo;
if "" == "%FONPATH%" (
set FONPATH=%CD%
)
)
)
if not exist "%FONPATH%" (
echo ××× [[%FONPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ FONPATH = [[%FONPATH%]]
)
pushd %FONPATH%
echo *** Starting from [[%CD%]] ***
echo;
echo === Enter [path to .gitignore] or [leave blank] for default to [[%CD%]]
set /p GITIGNOREPATH=">>> "
echo;
if "" == "%GITIGNOREPATH%" (
set GITIGNOREPATH=%CD%
)
if not exist "%GITIGNOREPATH%" (
echo ××× [[%GITIGNOREPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ GITIGNOREPATH = [[%GITIGNOREPATH%]]
)
for /d /r %%r in (*) do (
@REM @ if not "%%r" == ".vscode" (
echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || (
if exist "%%r\.gitignore" (
pushd "%%r"
echo ---- updating .gitignore in [[%%r]] ----
copy %GITIGNOREPATH%\.gitignore %%r\
echo;
popd
)
)
)
popd
:END
pause

View File

@ -1,42 +1,42 @@
@echo off
@REM 首先清除可能残留的变量
set FONPATH=
set ROOTPATH=
set FONPATH1=D:\faronear
set FONPATH2=C:\faronear
set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
set ROOTPATH1=D:\faronear
set ROOTPATH2=C:\faronear
set ROOTPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" (
set FONPATH=%1
set ROOTPATH=%1
) else (
echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]]
if exist "%FONPATH1%" (
set FONPATH=%FONPATH1%
) else if exist "%FONPATH2%" (
set FONPATH=%FONPATH2%
) else if exist "%FONPATH3%" (
set FONPATH=%FONPATH3%
echo *** Testing Path [[%ROOTPATH1%]] [[%ROOTPATH2%]] [[%ROOTPATH3%]]
if exist "%ROOTPATH1%" (
set ROOTPATH=%ROOTPATH1%
) else if exist "%ROOTPATH2%" (
set ROOTPATH=%ROOTPATH2%
) else if exist "%ROOTPATH3%" (
set ROOTPATH=%ROOTPATH3%
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter [start path]> or [leave blank] for default to [[%CD%]]
set /p FONPATH=">>> "
set /p ROOTPATH=">>> "
echo;
if "" == "%FONPATH%" (
set FONPATH=%CD%
if "" == "%ROOTPATH%" (
set ROOTPATH=%CD%
)
)
)
if not exist "%FONPATH%" (
echo ××× [[%FONPATH%]] not exist! Exit now. ***
if not exist "%ROOTPATH%" (
echo ××× [[%ROOTPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ FONPATH = [[%FONPATH%]]
echo √√√ ROOTPATH = [[%ROOTPATH%]]
)
pushd %FONPATH%
pushd %ROOTPATH%
echo *** Starting from [[%CD%]] ***
echo;
@ -44,13 +44,13 @@ echo;
@REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do ( if exist %%d/.git pushd %%d & echo --- git pulling: %%d ... & git pull & popd ) ) & popd )
for /d %%o in (*) do (
@ if not "%%o" == ".vscode" (
echo ======== entering [[%FONPATH%\%%o]] ========
echo ======== entering [[%ROOTPATH%\%%o]] ========
echo;
pushd %%o
for /d %%g in (*) do (
if exist "%%g\.git" (
pushd %%g
echo ---- git pulling [[%FONPATH%\%%o\%%g]] ----
echo ---- git pulling [[%ROOTPATH%\%%o\%%g]] ----
git pull --all
echo;
popd

View File

@ -2,27 +2,27 @@
if [ -d "$1" ]
then
FONPATH=$1
ROOTPATH=$1
else
echo ""
echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " FONPATH
read -p ">>> " ROOTPATH
echo ""
if [ ! "$FONPATH" ]
if [ ! "$ROOTPATH" ]
then
FONPATH=`pwd`
ROOTPATH=`pwd`
fi
fi
if [ ! -d "$FONPATH" ]
if [ ! -d "$ROOTPATH" ]
then
echo "××× [[$FONPATH]] not exist! Exit now. ***"
echo "××× [[$ROOTPATH]] not exist! Exit now. ***"
exit
else
echo "√√√ FONPATH = [[$FONPATH]]"
echo "√√√ ROOTPATH = [[$ROOTPATH]]"
fi
pushd $FONPATH
pushd $ROOTPATH
echo "*** Starting from [[`pwd`]] ***"
echo ""
@ -31,7 +31,7 @@ then
# for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。
ls -F | grep '/$' | grep -v 'node_modules' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名
do
echo "======== entering [[$FONPATH/$org]] ========"
echo "======== entering [[$ROOTPATH/$org]] ========"
echo ""
cd "$org";
for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格

View File

@ -1,42 +1,42 @@
@echo off
@REM 首先清除可能残留的变量
set FONPATH=
set ROOTPATH=
set FONPATH1=D:\faronear
set FONPATH2=C:\faronear
set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
set ROOTPATH1=D:\faronear
set ROOTPATH2=C:\faronear
set ROOTPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" (
set FONPATH=%1
set ROOTPATH=%1
) else (
echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]]
if exist "%FONPATH1%" (
set FONPATH=%FONPATH1%
) else if exist "%FONPATH2%" (
set FONPATH=%FONPATH2%
) else if exist "%FONPATH3%" (
set FONPATH=%FONPATH3%
echo *** Testing Path [[%ROOTPATH1%]] [[%ROOTPATH2%]] [[%ROOTPATH3%]]
if exist "%ROOTPATH1%" (
set ROOTPATH=%ROOTPATH1%
) else if exist "%ROOTPATH2%" (
set ROOTPATH=%ROOTPATH2%
) else if exist "%ROOTPATH3%" (
set ROOTPATH=%ROOTPATH3%
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter [start path] or [leave blank] for default to [[%CD%]]
set /p FONPATH=">>> "
set /p ROOTPATH=">>> "
echo;
if "" == "%FONPATH%" (
set FONPATH=%CD%
if "" == "%ROOTPATH%" (
set ROOTPATH=%CD%
)
)
)
if not exist "%FONPATH%" (
echo ××× [[%FONPATH%]] not exist! Exit now. ***
if not exist "%ROOTPATH%" (
echo ××× [[%ROOTPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ FONPATH = [[%FONPATH%]]
echo √√√ ROOTPATH = [[%ROOTPATH%]]
)
pushd %FONPATH%
pushd %ROOTPATH%
echo *** Starting from [[%CD%]] ***
echo;
@ -51,13 +51,13 @@ echo;
@REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do ( if exist %%d/.git pushd %%d & echo --- git pulling: %%d ... & git pull & popd ) ) & popd )
for /d %%o in (*) do (
@ if not "%%o" == ".vscode" (
echo ======== entering [[%FONPATH%\%%o]] ========
echo ======== entering [[%ROOTPATH%\%%o]] ========
echo;
pushd "%%o"
for /d %%g in (*) do (
if exist %%g\.git (
pushd "%%g"
echo ---- git commit and push [[%FONPATH%\%%o\%%g]] ----
echo ---- git commit and push [[%ROOTPATH%\%%o\%%g]] ----
git add . && git commit -m "%COMMIT_MESSAGE%" && git push
echo;
popd

View File

@ -2,27 +2,27 @@
if [ -d "$1" ]
then
FONPATH=$1
ROOTPATH=$1
else
echo ""
echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " FONPATH
read -p ">>> " ROOTPATH
echo ""
if [ ! "$FONPATH" ]
if [ ! "$ROOTPATH" ]
then
FONPATH=`pwd`
ROOTPATH=`pwd`
fi
fi
if [ ! -d "$FONPATH" ]
if [ ! -d "$ROOTPATH" ]
then
echo "××× [[$FONPATH]] not exist! Exit now. ***"
echo "××× [[$ROOTPATH]] not exist! Exit now. ***"
exit
else
echo "√√√ FONPATH = [[$FONPATH]]"
echo "√√√ ROOTPATH = [[$ROOTPATH]]"
fi
pushd $FONPATH
pushd $ROOTPATH
echo "*** Starting from [[`pwd`]] ***"
echo ""
@ -42,7 +42,7 @@ then
# for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。
ls -F | grep '/$' | grep -v 'node_modules' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名
do
echo "======== entering [[$FONPATH/$org]] ========"
echo "======== entering [[$ROOTPATH/$org]] ========"
echo ""
cd "$org";
for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格

View File

@ -1,35 +1,35 @@
@echo off
@REM 首先清除可能残留的变量
set FONPATH=
set ROOTPATH=
set FONPATH1=D:\faronear
set FONPATH2=C:\faronear
set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
set ROOTPATH1=D:\faronear
set ROOTPATH2=C:\faronear
set ROOTPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" (
set FONPATH=%1
set ROOTPATH=%1
) else (
echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]]
if exist "%FONPATH1%" (
set FONPATH=%FONPATH1%
) else if exist "%FONPATH2%" (
set FONPATH=%FONPATH2%
) else if exist "%FONPATH3%" (
set FONPATH=%FONPATH3%
echo *** Testing Path [[%ROOTPATH1%]] [[%ROOTPATH2%]] [[%ROOTPATH3%]]
if exist "%ROOTPATH1%" (
set ROOTPATH=%ROOTPATH1%
) else if exist "%ROOTPATH2%" (
set ROOTPATH=%ROOTPATH2%
) else if exist "%ROOTPATH3%" (
set ROOTPATH=%ROOTPATH3%
) else (
set FONPATH=..\..
set ROOTPATH=..\..
)
)
if not exist %FONPATH% (
echo ××× [[%FONPATH%]] not exist! Exit now. ***
if not exist %ROOTPATH% (
echo ××× [[%ROOTPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ FONPATH = [[%FONPATH%]]
echo √√√ ROOTPATH = [[%ROOTPATH%]]
)
pushd %FONPATH%
pushd %ROOTPATH%
echo *** Current path = [[%CD%]] ***
@REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do ( if exist %%d/.git pushd %%d & echo --- git pulling: %%d ... & git pull & popd ) ) & popd )
@ -37,7 +37,7 @@ echo *** Current path = [[%CD%]] ***
for /d %%o in (*) do (
@REM windows的链接文件会造成路径错误从而终止该循环从而导致下一轮乃至所有循环的工作目录错误。因此要过滤掉 .vscode 这个符号链接目录。
if not %%o == .vscode (
echo entering [[%FONPATH%\%%o]]
echo entering [[%ROOTPATH%\%%o]]
pushd %%o
for /d %%g in (*) do (
if exist %%g\.git (

View File

@ -2,34 +2,34 @@
if [ -d "$1" ]
then
FONPATH=$1
ROOTPATH=$1
else
echo ""
echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " FONPATH
read -p ">>> " ROOTPATH
echo ""
if [ ! "$FONPATH" ]
if [ ! "$ROOTPATH" ]
then
FONPATH=`pwd`
ROOTPATH=`pwd`
fi
fi
if [ ! -d "$FONPATH" ]
if [ ! -d "$ROOTPATH" ]
then
echo "××× [[$FONPATH]] not exist! Exit now. ***"
echo "××× [[$ROOTPATH]] not exist! Exit now. ***"
exit
else
echo "√√√ FONPATH = [[$FONPATH]]"
echo "√√√ ROOTPATH = [[$ROOTPATH]]"
fi
pushd $FONPATH
pushd $ROOTPATH
echo "*** Starting from [[`pwd`]] ***"
echo ""
# for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。
ls -F | grep '/$' | grep -v '=' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名
do
echo "======== entering [[$FONPATH/$org]] ========"
echo "======== entering [[$ROOTPATH/$org]] ========"
echo ""
cd "$org";
for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格
@ -37,7 +37,7 @@ do
if [ -d "$repo/.git" ]
then
cd "$repo"
# echo " changing repo url to [[$FONPATH/$org/$repo]]"
# echo " changing repo url to [[$ROOTPATH/$org/$repo]]"
# git remote remove origin
# git remote add origin https://git.faronear.org/$org/$repo
# git pull

View File

@ -47,7 +47,7 @@ alias egrep='egrep --color=auto'
alias su='su -'
alias npmc='npm --registry https://registry.npm.taobao.org'
alias npmr='npm --silent run'
alias curlw='curl -sSL -w "%{url_effective}\n --- %{http_code} | %{time_total} s | %{size_download} bytes\n\n"'
alias curlw='curl -sSL -o /dev/null -w "%{http_code} | %{time_total} s | %{size_download} bytes | %{url_effective}\n"'
if [ "$(uname)" = "Darwin" ]
then
alias l='ls -lG'

11
nixhome/.gitignore vendored
View File

@ -2,11 +2,18 @@
### 目录 #################################################################
# 自定义的后缀名,凡有 gitignore 后缀的都不进行同步
*.gitignore.*
*.gitignore.*/
*.gitignore
*.gitignore/
# 通用
.svn/
.deploy_git/
.idea/
.sass-cache/
.wrangler
/test/unit/coverage/
/test/e2e/reports/
node_modules/
@ -70,10 +77,6 @@ _desktop.ini
/db.json
# wo
*.gitignore.*
*.gitignore.*/
*.gitignore
*.gitignore/
# 服务端
/_archive/*
/_datastore/*

View File

@ -1,42 +1,42 @@
@echo off
@REM 首先清除可能残留的变量
set FONPATH=
set ROOTPATH=
set FONPATH1=D:\faronear
set FONPATH2=C:\faronear
set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
set ROOTPATH1=D:\faronear
set ROOTPATH2=C:\faronear
set ROOTPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" (
set FONPATH=%1
set ROOTPATH=%1
) else (
echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]]
if exist "%FONPATH1%" (
set FONPATH=%FONPATH1%
) else if exist "%FONPATH2%" (
set FONPATH=%FONPATH2%
) else if exist "%FONPATH3%" (
set FONPATH=%FONPATH3%
echo *** Testing Path [[%ROOTPATH1%]] [[%ROOTPATH2%]] [[%ROOTPATH3%]]
if exist "%ROOTPATH1%" (
set ROOTPATH=%ROOTPATH1%
) else if exist "%ROOTPATH2%" (
set ROOTPATH=%ROOTPATH2%
) else if exist "%ROOTPATH3%" (
set ROOTPATH=%ROOTPATH3%
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter [start path] or [leave blank] for default to [[%CD%]]
set /p FONPATH=">>> "
set /p ROOTPATH=">>> "
echo;
if "" == "%FONPATH%" (
set FONPATH=%CD%
if "" == "%ROOTPATH%" (
set ROOTPATH=%CD%
)
)
)
if not exist "%FONPATH%" (
echo ××× [[%FONPATH%]] not exist! Exit now. ***
if not exist "%ROOTPATH%" (
echo ××× [[%ROOTPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ FONPATH = [[%FONPATH%]]
echo √√√ ROOTPATH = [[%ROOTPATH%]]
)
pushd %FONPATH%
pushd %ROOTPATH%
echo *** Starting from [[%CD%]] ***
echo;
@ -44,14 +44,14 @@ echo;
@REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do if exist %%d/package.json ( pushd %%d & echo --- npm booting: %%d ... & npm run boot & popd ) ) & popd )
for /d %%o in (*) do (
@ if not "%%o" == ".vscode" (
echo ======== entering [[%FONPATH%\%%o]] ========
echo ======== entering [[%ROOTPATH%\%%o]] ========
echo;
pushd %%o
for /d %%g in (*) do (
@ if exist "%%g\package.json" (
findstr "\"boot\"" %%g\package.json >NUL && (
pushd %%g
echo ---- npm booting [[%FONPATH%\%%o\%%g]] ----
echo ---- npm booting [[%ROOTPATH%\%%o\%%g]] ----
npm run boot
echo;
popd
@ -68,7 +68,7 @@ echo;
if exist "%%r\package.json" (
findstr "\"boot\"" "%%r\package.json" >NUL && (
pushd %%r
echo ---- npm booting [[%FONPATH%\%%r]] ----
echo ---- npm booting [[%ROOTPATH%\%%r]] ----
npm run boot
echo;
popd

View File

@ -2,27 +2,27 @@
if [ -d "$1" ]
then
FONPATH=$1
ROOTPATH=$1
else
echo ""
echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " FONPATH
read -p ">>> " ROOTPATH
echo ""
if [ ! "$FONPATH" ]
if [ ! "$ROOTPATH" ]
then
FONPATH=`pwd`
ROOTPATH=`pwd`
fi
fi
if [ ! -d "$FONPATH" ]
if [ ! -d "$ROOTPATH" ]
then
echo "××× [[$FONPATH]] not exist! Exit now. ***"
echo "××× [[$ROOTPATH]] not exist! Exit now. ***"
exit
else
echo "√√√ FONPATH = [[$FONPATH]]"
echo "√√√ ROOTPATH = [[$ROOTPATH]]"
fi
pushd $FONPATH
pushd $ROOTPATH
echo "*** Starting from [[`pwd`]] ***"
echo ""
@ -31,7 +31,7 @@ then
# for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。
ls -F | grep '/$' | grep -v '=' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名
do
echo "======== entering [[$FONPATH/$org]] ========"
echo "======== entering [[$ROOTPATH/$org]] ========"
echo ""
cd "$org";
for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格

View File

@ -1,37 +1,37 @@
@echo off
@REM 首先清除可能残留的变量
set FONPATH=
set ROOTPATH=
@ if not "" == "%1" (
set FONPATH=%1
set ROOTPATH=%1
) else (
if exist D:\faronear (
set FONPATH=D:\faronear
set ROOTPATH=D:\faronear
) else (if exist C:\faronear (
set FONPATH=C:\faronear
set ROOTPATH=C:\faronear
) else (if exist %HOMEDRIVE%%HOMEPATH%\faronear (
set FONPATH=%HOMEDRIVE%%HOMEPATH%\faronear
set ROOTPATH=%HOMEDRIVE%%HOMEPATH%\faronear
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter [start path] or [leave blank] for default to [[%CD%]]
set /p FONPATH=">>> "
set /p ROOTPATH=">>> "
echo;
if "" == "%FONPATH%" (
set FONPATH=%CD%
if "" == "%ROOTPATH%" (
set ROOTPATH=%CD%
)
)))
)
if not exist "%FONPATH%" (
echo ××× [[%FONPATH%]] not exist! Exit now. ***
if not exist "%ROOTPATH%" (
echo ××× [[%ROOTPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ FONPATH = [[%FONPATH%]]
echo √√√ ROOTPATH = [[%ROOTPATH%]]
)
pushd %FONPATH%
pushd %ROOTPATH%
echo *** Starting from [[%CD%]] ***
echo;
@ -40,7 +40,7 @@ for /d /r %%r in (*) do (
echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || (
if exist "%%r\node_modules" (
pushd "%%r"
echo ---- Deleting [[%FONPATH%\%%r]] ----
echo ---- Deleting [[%ROOTPATH%\%%r]] ----
rd /s /q node_modules
echo;
popd

View File

@ -0,0 +1,71 @@
@echo off
@REM 首先清除可能残留的变量
set ROOTPATH=
set ROOTPATH1=D:\faronear
set ROOTPATH2=C:\faronear
set ROOTPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" (
set ROOTPATH=%1
) else (
echo *** Testing Path [[%ROOTPATH1%]] [[%ROOTPATH2%]] [[%ROOTPATH3%]]
if exist "%ROOTPATH1%" (
set ROOTPATH=%ROOTPATH1%
) else if exist "%ROOTPATH2%" (
set ROOTPATH=%ROOTPATH2%
) else if exist "%ROOTPATH3%" (
set ROOTPATH=%ROOTPATH3%
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter [start path] or [leave blank] for default to [[%CD%]]
set /p ROOTPATH=">>> "
echo;
if "" == "%ROOTPATH%" (
set ROOTPATH=%CD%
)
)
)
if not exist "%ROOTPATH%" (
echo ××× [[%ROOTPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ ROOTPATH = [[%ROOTPATH%]]
)
echo === Enter [path to seafile-ignore.txt] or leave [blank] for default to [[%CD%]]
set /p IGNOREPATH=">>> "
echo;
if "" == "%IGNOREPATH%" (
set IGNOREPATH=%CD%
)
if not exist "%IGNOREPATH%" (
echo ××× [[%IGNOREPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ IGNOREPATH = [[%IGNOREPATH%]]
)
pushd %ROOTPATH%
echo *** Starting from [[%CD%]] ***
echo;
for /d /r %%r in (*) do (
@REM @ if not "%%r" == ".vscode" (
echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || (
if exist "%%r\.git" (
echo ---- updating seafile-ignore.txt in [[%%r]] ----
copy %IGNOREPATH%\seafile-ignore.txt %%r\
echo;
)
)
)
popd
:END
pause

View File

@ -0,0 +1,48 @@
#!/bin/bash
if [ -d "$1" ]
then
ROOTPATH=$1
else
echo ""
echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " ROOTPATH
echo ""
if [ ! "$ROOTPATH" ]
then
ROOTPATH=`pwd`
fi
fi
if [ ! -d "$ROOTPATH" ]
then
echo "××× [[$ROOTPATH]] not exist! Exit now. ***"
exit
else
echo "√√√ ROOTPATH = [[$ROOTPATH]]"
fi
echo "=== Enter [path to seafile-ignore.txt]"
read -p ">>> " IGNOREPATH
echo ""
if [ ! -f "$IGNOREPATH/seafile-ignore.txt" ]
then
echo "××× Not found [[$IGNOREPATH/seafile-ignore.txt]]. Exit now..."
exit
fi
cd $ROOTPATH
echo "*** Starting from [[`pwd`]] ***"
echo ""
find . -mindepth 1 -maxdepth 3 -type d -name '[^.]*' | grep -E -v 'node_modules|uni_modules|\.deploy_git|\.git|.svn|\.vscode|\.wrangler|unpackage|_webroot|_logstore|_datasotre|_archive|_filestore|_ssl' | while read repo
do
if [ -f "$repo/seafile-ignore.txt" ]
then
echo "---- updating seafile-ignore.txt in [[$repo]] ----"
cp $IGNOREPATH/seafile-ignore.txt $repo/
echo ""
fi
done
cd -

View File

@ -1,71 +0,0 @@
@echo off
@REM 首先清除可能残留的变量
set FONPATH=
set FONPATH1=D:\faronear
set FONPATH2=C:\faronear
set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" (
set FONPATH=%1
) else (
echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]]
if exist "%FONPATH1%" (
set FONPATH=%FONPATH1%
) else if exist "%FONPATH2%" (
set FONPATH=%FONPATH2%
) else if exist "%FONPATH3%" (
set FONPATH=%FONPATH3%
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter [start path] or [leave blank] for default to [[%CD%]]
set /p FONPATH=">>> "
echo;
if "" == "%FONPATH%" (
set FONPATH=%CD%
)
)
)
if not exist "%FONPATH%" (
echo ××× [[%FONPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ FONPATH = [[%FONPATH%]]
)
echo === Enter [path to seafile-ignore.txt] or leave [blank] for default to [[%CD%]]
set /p SFIGNOREPATH=">>> "
echo;
if "" == "%SFIGNOREPATH%" (
set SFIGNOREPATH=%CD%
)
if not exist "%SFIGNOREPATH%" (
echo ××× [[%SFIGNOREPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ SFIGNOREPATH = [[%SFIGNOREPATH%]]
)
pushd %FONPATH%
echo *** Starting from [[%CD%]] ***
echo;
for /d /r %%r in (*) do (
@REM @ if not "%%r" == ".vscode" (
echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || (
if exist "%%r\.git" (
echo ---- updating seafile-ignore.txt in [[%%r]] ----
copy %SFIGNOREPATH%\seafile-ignore.txt %%r\
echo;
)
)
)
popd
:END
pause

View File

@ -1,48 +0,0 @@
#!/bin/bash
if [ -d "$1" ]
then
FONPATH=$1
else
echo ""
echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " FONPATH
echo ""
if [ ! "$FONPATH" ]
then
FONPATH=`pwd`
fi
fi
if [ ! -d "$FONPATH" ]
then
echo "××× [[$FONPATH]] not exist! Exit now. ***"
exit
else
echo "√√√ FONPATH = [[$FONPATH]]"
fi
echo "=== Enter [path-to-seafile-ignore.txt]"
read -p ">>> " SFIGNOREPATH
echo ""
if [ ! -f "$SFIGNOREPATH/seafile-ignore.txt" ]
then
echo "××× Not found [[$SFIGNOREPATH/seafile-ignore.txt]]. Exit now..."
exit
fi
cd $FONPATH
echo "*** Starting from [[`pwd`]] ***"
echo ""
find . -mindepth 1 -maxdepth 3 -type d -name '[^.]*' | grep -E -v 'node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl' | while read repo
do
if [ -d "$repo/.git" ]
then
echo "---- updating seafile-ignore.txt in [[$repo]] ----"
cp $SFIGNOREPATH/seafile-ignore.txt $repo/
echo ""
fi
done
cd -