2
zip compress.zip /from/this/path/settings.json

I have the command above, but would like to store in /path/settings.json instead of /from/this/path/settings.json in the zip file.

How do I go about it?

bilogic
  • 233
  • 1
  • 3
  • 9
  • Is it enough with a method that works for a single file or do you need a method, that works for a whole directory tree with several directories and subdirectories with files? 2. Would it be OK to use a method with some other tool(s), for example gzip (and tar if a whole directory tree)?
  • – sudodus Jan 23 '23 at 09:59
  • 1
    actually i found a "workaround", change working directory to /from/this and zip from there. But to answer your qn: 1. I would say multiple files, because I'm after the folders, although there is only 1 file now. 2. preferably not, I mean, I just want it to be an easy to read 1 liner. – bilogic Jan 23 '23 at 10:03
  • Your workaround is good :-) It is possible to use a oneliner (or corresponding alias) also with tar (and let it use compression with gzip: tar -cvzf ball.tar.gz directory-tree or xz: tar -cvJf ball.tar.xz directory-tree) – sudodus Jan 23 '23 at 10:18