S
S
shasoft2018-06-01 12:36:28
SSH
shasoft, 2018-06-01 12:36:28

How to exclude folder name when zipping over ssh?

In the folder XXX files

  • yyy1.txt
  • yyy2.txt

I pack the XXX folder into an archive using the SSH command
zip -r xxx.zip XXX/
. At the same time, the folder name XXX also gets into the archive, so the file names in the archive look like
  • XXX/yyy1.txt
  • XXX/yyy2.txt

Is there a way to pack by excluding the name XXX ? To have files in the archive
  • yyy1.txt
  • yyy2.txt

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry, 2018-06-01
@Tabletko

zip -r xxx.zip XXX/*

S
Sergey, 2018-06-01
@feanor7

cd /XXX/ ; zip -r /XXX/out2.zip * ; cd .

V
Vladislav Istomin, 2018-09-27
@vladsold

zip -rj xxx.zip XXX/*
-j removes all folders from the archive

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question