I have a zip file which I extract to a folder. I then need to open the files and perform various functions but the files are not modified or saved at all.
I use Dotnetzip to extract the files from the archive before the files are opened and viewed etc.
Is there a way to compare the files, which was extracted, to the files still inside the zip file without extracting those files again? The zip files I have is quite large. Some of them several 100 Mb's so don't want to wait for another extraction process again.
Thanks!
Related
I've been trying to copy files from one directory to another and then changing all the files I moved into .txt files. The only problem is that there are multiple, probably 30+ different extensions and hard coding them is not an option because there could be different extensions in different output folders. I've been able to move all the files from one to another pretty easily, but being able to change every extension in a folder (.ser, .pbr, etc,) to a .txt has proven difficult. If anyone could help that would be great. This is my code for moving files from one folder to another so I just need to be able to change the files to .txt either while they are being moved or after they've been copied to the new folder.
src = 'L:/Development/DCS/UL/Dev\202209\1_202206_4355_4359/OUTPUT/202112'
trg = 'L:/Development/DCS/UL/Dev/Test Output'
files=os.listdir('L:/Development/DCS/UL/Dev/202209/1_202206_4355_4359/OUTPUT/202112')
# iterating over all the files in
# the source directory
for fname in files:
try:
# copying the files to the
# destination directory
shutil.copy2(os.path.join('L:/Development/DCS/UL/Dev/202209/1_202206_4355_4359/OUTPUT/202112',fname), 'L:/Development/DCS/UL/Dev/Test Output')
except:
print ("error")
pass
I want to compare catalog with compressed without extracting or compress files and compare. Is there any way to compare directory with compressed directory ?
Example:
I have some files in tmpfs (ramdisk), before server shutdown, I need to save files to disk. In my opinion best way is compress files and save to disk like a file. On start server (system) I want to decompress files in to the ramdisk. But after couple days ramdisk files will be updated (different with compress file backup).
How to compare and merge diff ?
Regards,
Nerus.
Executing:
tar -tvf foo.tar.gz
will show the contents of the compressed file without decompressing. You can then compare the files.
I would like to create a zip that contains just a subset based on another zip file. Is there a smarter way to do this than just extracting the specific files and then re-zipping them under a new name?
I'm looking for an efficient way to do this, as the original file will contain thousands and thousands of files and will have a rough size of ~30 GB.
by deleting other stuff e.g.:
zip --delete file.zip junk/*
Second option is by listing zip file with
zipinfo -1 file.zip >list.files
and edit temporally file list to include. Then you
unzip file.zip $(cat list.files)
and create new zip file. Of course the same file can be used for exclusion for zip --delete. Or you can do the same using its on the fly file list in combination with grep for instance.
Check also https://bitbucket.org/agalanin/fuse-zip
Does anybody know of any way (on Windows) to create an archive (zip, rar,..) and adding files to it by importing a list of files to be added (say from a CSV or text file or simply pasted) that need to be archived. Say I have a simple list of 1,000 files across multiple directories that I want to add to an archive, this would be a much simpler method of doing it than adding each file individually. Also I do not want to arhive the entire directory as it is absolutely massive.
eg:
c:\somedir\file1.php
c:\somedir\somesubdir\file2.php
c:\someotherdir\file3.php
...
And no I do not want to import all files in certain directories, the hundreds of files are scattered across tens of directories which also contain lots of other files that I do not want to archive.
Thanks
rar.exe from WinRAR has the following option:
n#<list> Include files listed in specified list file
Does anyone know if it is possible to get the name of files inside a rar/zip without having to unrar/unzip the file.. and if yes, is there a way to block it or make difficult..
Thanks
The file names in a zip file are visible even if the data is encrypted. If you want to hide the names, the easy solution is to zip the zip file encrypted.
Later versions of PKZip do have an option to encrypt the file names as well with –cd=encrypt. (cd means central directory.)
The -l flag to unzip(1) does just that:
-l
list archive files (short format). The names, uncompressed file sizes and modification dates and times of the specified files are printed, along with totals for all files specified.
unrar(1) has the l option:
l
List archive content.