2

I tried to use 7zip to create an archive for a folder. It compressed all the files and said everything was ok. but I could not find the archive inside the directory containing the folder. Here are my command and part of the output:

$p7zip folder/
...
Creating archive: folder/.7z
Items to compress: 786
...
Files read from disk: 653
Archive size: 3155722 bytes (3082 KiB)

Everything is Ok

I assumed 7zip created an archive but I could not find it anywhere. Does anyone know where 7zip output the archive?

  • 2
    It says it created the archive with the filename folder/.7z. Try ls -alF folder/.7z – Chai T. Rex Oct 16 '18 at 20:10
  • I typed that in and it gave me this line: -rw-r--r-- 1 ken ken 3155722 Oct 16 15:15 folder/.7z – Kingle Oct 16 '18 at 20:49
  • Note that a filename beginning with a single dot is commonly treated as a hidden file, including by "ls" if not adding extra flags. This is likely why you couldn't find it. – thomasrutter Oct 17 '18 at 1:11
2

Your 7zip file is in folder/.7z. The output of the command tells you: Creating archive: folder/.7z. You didn't specify a filename so it made the file without one. Just an extension. I'd recommend using the command find if you have problems locating files. Take a look at my example, I've recreated your scenario below.

root@myputer:~/test# mkdir folder/  
root@myputer:~/test# p7zip folder/

7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,4 CPUs Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz (306C3),ASM,AES-NI)

Scanning the drive: 1 folder, 0 files, 0 bytes

Creating archive: folder/.7z

Items to compress: 1

   Files read from disk: 0  
   Archive size: 90 bytes (1 KiB)   
   Everything is Ok

root@myputer:~/test# find folder
folder folder/.7z

root@myputer:~/test# cd folder/  
root@myputer:~/test/folder# ll 
total 12  
drwxr-xr-x 2 root    root    4096 Oct 16 16:34 ./
drwxrwxr-x 3 me      me      4096 Oct 16 16:33 ../
-rw-r--r-- 1 root    root      90 Oct 16 16:34 .7z

There is your file .7z.

  • Ah I see. So it's still inside the directory but without a filename. No wonder I used ls and it didn't list the archive. – Kingle Oct 16 '18 at 20:53
  • 1
    Yes, because you made the file with a dot, when you did a ls it returned nothing. You have to do a ls -a or ll which will show you all files. See the man page for the -a (all) parameter. It will make sense. – G_Style Oct 16 '18 at 21:00
  • @G_Style selecting multiline terminal output in your answer and clicking the {} button in the editor will format it properly with proper linebreaks and everything. – Chai T. Rex Oct 17 '18 at 0:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.