Follow-up: 7z create individual archive for each file

dvdom

New Member
Joined
Mar 1, 2022
Messages
8
Reaction score
0
Credits
77
Last week, you guys helped me create an archive for each folder in 7z.
Here is the command: for file in ~/Desktop/to_backup/*; do 7z a -pMyPassword -mhe ~/Desktop/backup/"$(basename $file)".7z "$file"; done

However, I have huge amounts of data in my directories and would prefer not to compress each directory. I would like to compress each individual file and have the compressed file made using the same folder structure.

Example:
~/Desktop/to_backup/
Directory_1:
File_1.xxx​
File_2.xxx​
Directory_2:​
File_1.xxx​
File_2.xxx​
After running the backup:​
~/Desktop/backup/
Directory_1:
File_1.7z​
File_2..7z​
Directory_2:​
File_1.7z​
File_2.7z​
Can you guys help me with this?​
 


JasKinasis

Well-Known Member
Joined
Apr 25, 2017
Messages
1,464
Reaction score
2,082
Credits
10,249
Sorry I didn’t get a chance to follow up your request. I’ve been busy. I have an idea, but I’m away from home this weekend. I don’t have my laptop available to test it.
I’ll try to respond in the next few days!
 
OP
D

dvdom

New Member
Joined
Mar 1, 2022
Messages
8
Reaction score
0
Credits
77
Sorry I didn’t get a chance to follow up your request. I’ve been busy. I have an idea, but I’m away from home this weekend. I don’t have my laptop available to test it.
I’ll try to respond in the next few days!
Your'e the best! I sincerely appreciate it!
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online

No members online now.

Top