Using the following command:
tar --exclude="./.*" -czvf /Volumes/Foo/2016-04-14_2051_full.tar.xz ./
Which follows this advice, still gets also hidden files archived:
a .
a ./.Trashes
a ./.fseventsd
a ./data
What can I do to only get the ./data folder archived?
Update: I use a Mac and zsh shell.
I now used the workaround:
XZ_OPT=-9e tar --exclude='./old' --exclude='.*' -cJvf /Volumes/Foo/$(date +%Y%m%dT%H%M)_full.tar.xz * -g incremetal
Hope it helps someone else as well
Related
I'm trying to build a DockerFile for a project around GCP.
I'm using go version 1.17 and it fails at the get command saying that go.mod isn't found but it exist in the same directory as the Dockerfile. I already tried go mod init and go mod tidy but I still got the same error. Here are my env variables and my files :
GO111MODULE="auto"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/name/.cache/go-build"
GOENV="/home/name/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/name/work/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/name/work"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.1"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/name/workspace/professional-services/tools/gcs2bq/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3855548593=/tmp/go-build -gno-record-gcc-switches"
list of the files in my working directory :
name#vm-gcs2bq:~/workspace/professional-services/tools/gcs2bq$ ls
Dockerfile bigquery.schema datastudio.png gcs2bq.avsc go.mod main.go
README.md credentials.json gcs2bq-custom-role.yaml gcs2bq.yaml go.sum run.sh
My working directory in the Dockerfile is correctly set (the gcs2bq one) and when trying to build it I got :
Step 6/16 : RUN go get -v ./...
---> Running in ebaa284887cf
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
I'm still kinda new to go, mostly did c and python and I read that packages are managed in a different way in this language but I think I set my paths correctly too. Correct me if I'm wrong.
Any help is appreciated, ask for more details if you need to.
Thanks in advance !
Okay I solved my problem.
First, my WORKDIR wasn't pointing at the right directory : WORKDIR /go/src/github.com/rosmo/gcs2bq instead of WORKDIR /work/src/github.com/rosmo/gcs2bq but it's only because of me using /work instead of /go for the installed packages.
Then I added the follwing after the COPY main.go . command :
RUN go mod init v1
RUN go mod tidy
Which created the "missing" go.mod file and properly installed the dependencies/packages needed.
The rest of the build went perfectly normal.
Thanks for your help.
I have been working on a custom patch for my car with MIB2 unit for some time and would like to try my modified MIBRoot file.
The command I used to repack everything is:
mkxfs -t ifs -nn -o ./ -r / ./mkifs_attributes.txt ./ifs_extracted ./patched_ifs.ifs
But the problem is that the repackaging is not working properly, because the mkifs_attribute.txt file used is probably not fine for my MIB2 or I have a version that is not correct.
In fact, when I do a:
diff -r ./original/ifs_extracted ./repack/ifs_extracted
all files in ./repack/ifs_extracted are different from the originals, when instead only the MIBRoot file should be different.
my mkifs_attribute contain this:
#Porsche PCM4/MIB2 ifs-root (stage 2) attributes file
#Before packing FS: EXPORT QNX_TARGET="/"
#Command to pack: mkxfs -t ifs -nn -o ./ -r / attributes.txt /unpacked_fs /packed_fs.ifs
[-followlink] #Do not resolve links
[compress=2] #LZO Compression
[-bigendian] #Little Endian (ARMLE)
[-autolink] #Do not auto link shared objects
[perms=777] #chmod 777
[uid=0 gid=0] #chown root:root
#You can add a script to be executed after mount here, one line only
#[+script] .script = {
#touch /dev/shmem/AudioFadedIn; touch /dev/shmem/production_mode}
#Symlinks. Add lines here to match your dumpifs symlinks
#[type=link] dest_file=source_file
[type=link] /lib/SPC_configuration.so=/lib/libSPC_configuration.so
[type=link] /lib/AudioConfig_ARM.so=/lib/libAudioConfig_ARM.so
[type=link] /lib/AudioConfig_DSP.so=/lib/libAudioConfig_DSP.so
[type=link] /usr/bin/flashunlock=/usr/bin/flashlock
[type=link] /usr/bin/libi2c-inic-master.so=/lib/libi2c-inic-master.so.1.0
[type=link] /lib/librdshbfpga.so.1.0.0=/lib/librdshbfpga.so
[type=link] /lib/libSysMoCCAFrameworkSharedSo.so=/lib/libSysMoCCAFrameworkSharedSo.so.6
[type=link] /lib/AudioConfig_DSP.so=/lib/libAudioConfig_DSP.so
[type=link] /lib/liba2itodspipc.so=/lib/liba2itodspipc.so.1
Or am i wrong something?
If anyone has a correct mkxfs and mkxfs_attribute.txt could you please provide it to me so I can give it a try?
I have a project folder with several directories
- archive
- include
- lib
- src
- src/obj (obj is a subdirectory of src)
I would like tar to pack these directories and their contents into a main.tar, then I will the main.tar into the archive directory.
tar cvz \
--exclude="*.obsolete" --exclude="*DS_Store" --exclude="./archive/*" \
-f main.tar \
./archive ./include ./lib ./src
I would like to exclude the contents of the archive directory but still package the empty directory itself. You can see I am also excluding some other stuff from various places, OSX likes to write .DS_Store files everywhere on my filesystem and I occasionally make copies of files and append .obsolete to the end while working on a new version.
Unfortunately, the empty archive directory is not included in main.tar.
According to this thread, my command should work.
How can the files be excluded from archive but the empty directory be packed into the tar file?
edit
The following fails:
--exclude="./archive/*"
The following works:
--exclude="./archive/*.*"
So the whole command is:
tar cvz \
--exclude="*.obsolete" --exclude="*DS_Store" --exclude="./archive/*.*" \
-f main.tar \
./archive ./include ./lib ./src
I want to tar/zip a directory ./ (current working directory) and exclude files in the directory ./vendor, I happened to also have a subdirectory named vendor at ./public/web/vendor, but I want to keep that. I've tried:
tar cfz /private/var/folders/temp/mage6BRQWJ.tar.gz --exclude=vendor/* ./
tar cfz /private/var/folders/temp/mage6BRQWJ.tar.gz --exclude=./vendor/* ./
tar cfz /private/var/folders/temp/mage6BRQWJ.tar.gz --exclude="vendor/*" ./
But these both exclude the subdirectory.
I want to use relative path because I want to exclude all .svn (e.g. example) files from all directories, too.
Is there a way, using relative path , to exclude files in the ./vendor directory but not ./public/web/vendor ?
All you need is the --anchored tag:
GNU tar:
tar cfz mage6BRQWJ.tar.gz --anchored --exclude=vendor *
bsdtar:
bsdtar -czf mage6BRQWJ-1.tar.gz --exclude=^vendor *
That works.
I'm using tar to make daily backups of a server and want to avoid backup of /proc and /sys system directories, but without excluding any directories named "proc" or "sys" somewhere else in the file tree.
For, example having the following directory tree ("bla" being normal files):
# find
.
./sys
./sys/bla
./foo
./foo/sys
./foo/sys/bla
I would like to exclude ./sys but not ./foo/sys.
I can't seem to find an --exclude pattern that does that...
# tar cvf /dev/null * --exclude=sys
foo/
or...
# tar cvf /dev/null * --exclude=/sys
foo/
foo/sys/
foo/sys/bla
sys/
sys/bla
Any ideas?
(Linux Debian 6)
You can specify absolute paths to the exclude pattern, this way other sys or proc directories will be archived:
tar --exclude=/sys --exclude=/proc /
Using tar you can exclude directories by placing a tag file in any directory that should be skipped.
Create tag files,
touch /sys/.exclude_from_backup
touch /proc/.exclude_from_backup
Then,
tar -czf backup.tar.gz --exclude-tag-all=.exclude_from_backup *
In this case you might want to use:
--anchored --exclude=sys/\*
because in case your tar does not show the leading "/" you have a problem with the filter.