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:
Directory_1:
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?