7z压缩gopath的src的批处理

7zGoPath.bat

@echo off
pushd "%~dp0"
:config
for /f "delims=" %%t in ('powershell /command "Get-Date -Format 'yyyy-MM-dd-HH-mm-ss'"') do set datetime=%%t
set output="%USERPROFILE%\Desktop\gopath_%datetime%_src.7z"
set input="%GOPATH%\src"
set xr=-xr!yourpath\
set cmd="%PROGRAMFILES%\7-zip\7z.exe"
:exec
%cmd% a -mx=9 %output% %input% %xr%
echo Press any key to EXIT...
pause>nul
:end
popd

 

mac:

$ 7za a -mx=9 ~/Desktop/gopath_`date +%Y-%m-%d-%H-%M-%S`_src.7z $GOPATH/src -xr\!yourpath/

 

-xr用于排除不需要备份的路径。

转载于:https://www.cnblogs.com/Bob-wei/p/8358582.html

你可能感兴趣的:(7z压缩gopath的src的批处理)