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%Desktopgopath_%datetime%_src.7z" set input="%GOPATH%src" set xr=-xr!yourpath set cmd="%PROGRAMFILES%7-zip7z.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用于排除不需要备份的路径。