1

So i was trying to compress lolok folder using 7z command :

7z a Documents/lolok/

But i forgot to create a name for compressed folder, which should be like this :

7z a cobas.7z Documents/lolok/

Too late, 7z is compresssing /home/my_username instead of Documents/lolok, it shows something like this :

Compressing  Fake-Dropbox/My Stuff/MintLeaf40/cursors/00000000000000020006000e7e9ffc3f      
Compressing  Fake-Dropbox/My Stuff/MintLeaf40/cursors/00008160000006810000408080010102            
Compressing  .compiz/session/10101c66bb4692d073143743666037107700000020450001         
Compressing  .compiz/session/101039ec7cc6d9a45143830416643541000000020470001          
Compressing  .compiz/session/10104df3378a4b5f2c143415919040916300000020980001         
Compressing  .compiz/session/1010ad420c7b22ed95142202369753202900000020760001         
Compressing  .compiz/session/101104e28f9f142f95142534455518842300000021110001         
Compressing  .compiz/session/1012259bfe2f6664142572736424702700000020920001           
Compressing  .compiz/session/1012e8ceb6dad57094143839895664962200000020340001         
Compressing  .compiz/session/101441cf55618896c4142425317361606900000020900001

(Actually it shows many "Compressing" message, but due to security reason i didnt post them here)

I press Ctrl + C then, then i get "permission denied: error :

WARNINGS for files:

.cache/dconf/ : Permission denied                
.cache/thumbnails/large/ : Permission denied                
.gvfs/ : Permission denied                
.config/enchant/ : Permission denied                
 ----------------
WARNING: Cannot find 4 files

Break signaled

Is something like this can destroy my system ? Please explain why 7z compressing my home directory instead of Documents/lolok ?

1 Answer 1

1

7z a expects and archive name (or a stub, without an extension) and then an optional list of files. If it doesn't get a list of files, it starts from the current working directory and just works recursively.

So to answer your question, nothing deleted or damaged but it has likely made a file called Documents/lolok/.7z (a hidden file). Again, it won't have removed anything.

The permission denied errors are because (it seems) you were running the command as a different user and those directories were protected from other people reading them, eg:

$ ll -d .cache/dconf/
drwx------ 2 oli oli 4096 Nov  7  2012 .cache/dconf/

Here's a real demonstration. We'll start by creating some files and a subdirectory in a test directory.

$ mkdir test; cd test; touch {1..3}.file; mkdir testdir
$ ls -l
total 4
-rw-rw-r-- 1 oli oli    0 Aug 14 08:48 1.file
-rw-rw-r-- 1 oli oli    0 Aug 14 08:48 2.file
-rw-rw-r-- 1 oli oli    0 Aug 14 08:48 3.file
drwxrwxr-x 2 oli oli 4096 Aug 14 08:48 testdir

Then we emulate your 7z command and see what happens:

$ 7z a testdir/

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_GB.UTF-8,Utf16=on,HugeFiles=on,8 CPUs)
Scanning

Creating archive testdir/.7z

Everything is Ok

No permissions errors because I own everything in there and have permission for it. And it's created a file called .7z in the subdirectory. Let's list its contents:

$ 7z l testdir/.7z

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_GB.UTF-8,Utf16=on,HugeFiles=on,8 CPUs)

Listing archive: testdir/.7z

--
Path = testdir/.7z
Type = 7z
Solid = -
Blocks = 0
Physical Size = 147
Headers Size = 147

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2015-08-14 08:48:26 ....A            0            0  1.file
2015-08-14 08:48:26 ....A            0            0  2.file
2015-08-14 08:48:26 ....A            0            0  3.file
2015-08-14 09:42:16 D....            0            0  testdir
------------------- ----- ------------ ------------  ------------------------
                                     0            0  3 files, 1 folders
1
  • Thank you ! So no need to be worry again :D again thank you very much !
    – Liso
    Aug 14, 2015 at 11:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .