I have a list that includes the paths of the files (in my case movies), which is called collectMovies and has followed data structure:
['C:\\Users\\UserName\\Desktop\\Movies\\pso-cash-sd.mkv',
'C:\\Users\\UserName\\Desktop\\Movies\\hda-casino.royale.uncut-1080p.mkv']
How can I compress the movies, so that only the movie and not the whole directories are compressed and shown up in the 7zip archive?
What I tried was that:
import py7zr
with py7zr.SevenZipFile("files.7z","w") as mov:
for val in collectMovies:
val = val.replace(r"\\",r"\\")
try:
mov.write(val)
except:
print("File not Found")
This works, but it writes also the directories. I only want to write the movie file in the archive.
C:\\Users\\UserName\\Desktop\\Movies\\pso-cash-sd.mkv
What I want is, that only pso-cash-sd.mkv is shown up in the compressed archive.
The actual output looks like this (with subfolders):
What I want is, that only the movie(s) are shown up, like:

