I need to add a new file into a zip archive which has been split into volumes of 200mb each. Is there a way to add this file without unzipping it an zip it again?
I have these 3 parts
_default.zip.001
_default.zip.002
_default.zip.003
all of them creating _default.zip archive
and when I try to run
7z a -tzip .\_default.zip.001 some_file
I get
ERRORS: Unexpected end of archive
since this is just one part of the actual archive.
Is this thing possible? If so, how?
7z a -v300m yourarchive2zip.7z files2zip
Related
After Googling and "researching" for over 3 hours to no avail, i have turned here to possibly get some help to my issue. Either if its possible or not to some extent.
This is a bit messy i know, but i'm fairly new to this.
What im trying to do.
I want to Backup a File which adds it to a archive folder With a Timestamp to it. YYYY-MM-DD Which then contains the File
2021-03-09.rar
File01.db
Then it takes the created file and adds it to a Backup.rar
Backup.rar
2021-03-09.rar
File01.db
Now i got this to work, My only problem here is that it instead overwrites the current existing File "2021-03-09.rar" in the Archive "Backup.rar" with the new one, instead of adding a number to the new backup that i added.
This is how i want/it should do;
Backup01: 2021-03-09.rar
Backup02: 2021-03-09-01.rar
Backup03: 2021-03-09-02.rar
Backup04: 2021-03-09-03.rar > and so on.
Code/what i have tried
I have tried using the commands "M" and "U" but same result, i tried using -or as well, which should rename files automatically if a file with the same name exists, but it doesnt work and the file(2021-03-09.rar) in my archive(Backup.rar) gets overwritten instead with the new backup(2021-03-09.rar).
Code:
"%ProgramFiles%\WinRAR\rar.exe" a -agYYYY-MM-DD -cfg -ep1 -m5 -r -y "C:\Users\%UserProfile%\Documents\0-Background\BAT FILES\Database Backups\Backups\.rar" "C:\Users\%UserProfile%\Documents\0-Background\BAT FILES\Database Backups\File01db"
"%ProgramFiles%\WinRAR\rar.exe" a -or -ep "C:\Users\%UserProfile%\Documents\0-Background\BAT FILES\Database Backups\Backups.rar" "C:\Users\%UserProfile%\Documents\0-Background\BAT FILES\Database Backups\Backups\*"
While i know its not the smartest way to add a rar file to another rar file, its what i decided to do, it might be smarter to just have the bat file create a folder that it then adds to the archive or if it creates a folder in winrar and then adds the file to the folder in the archie, but it seemed to advanced.
Use YYYYMMDD and add an archive number, where the archive number is a numeric value starting from 1.
That will generate unique names even when the YYYY-MM-DD-NN format mask is used more than once in the same day.
WinRAR a -agYYYY-MM-DD-NN backup
WinRAR searches for already existing archives with that generated name and if found, increments the archive number to generate an unused name.
Refer to WinRAR, Help. Help topics and search for '-ag'
I am using PDFtk-server to merge 2 PDF files. This creates a new PDF with name Test_.
Now, what I am looking for is a batch files that renames the Test_ files to Test_datestamp and then move them into another folder and delete the files.
It is working if only one file is present.
pdftk C:\test\*.pdf C:\test\file-to-add\file.pdf cat output C:\test\output\Test_.pdf
ren "C:\test\output\*pdf" "Test_ - %date:/=.% %time::=-%.pdf"
del C:\test\*.pdf
Then comes to copy part to other folders.
If having multiple files, the first one gets renamed but other not, because it is trying to set the same timestamp, so I need some kind of delay between renaming.
i'm a near complete beginner to batch scripting.
I'm currently learning how to create batch files. My goal is to compress a folder using exclusively InfoZip, add the date to the file name, and have that file copied to an USB memory stick plugged on H:\
The reason why i need to use InfoZip, even though it is a very old program, is because i need somthing that works even on Win95.
InfoZip is not installed, it is just unpacked in folder and ready to use.
It is possible to download InfoZip 3.0 from here:
https://sourceforge.net/projects/infozip/
Anyway, so far, the only thing i could come up with is this...
--------------------------------------
Title : Your folder will be zipped into an archive that will be copied on the USB memory stick plugged on your computer. Please DO NOT remove the memory stick during the operation.
#ECHO OFF
call d:\infozip\wiz.exe
pause
--------------------------------------
It just brings up the InfoZip window on the screen, but then i have absolutely no idea about how to make it zip a folder, add the date, and copy that zipped file to the USB.
All the regular commands meant for 7-zip or Winzip don't seem to work with InfoZip.
I could really use some help, please :)
Thanks!
Using the waybackmachine I was able to get the documentation for info-zip:
https://web.archive.org/web/20170829173722/http://www.info-zip.org/mans/zip.html#EXAMPLES
In contrary to what zip.exe shows, the syntax for zipping files is this:
zip -r zipfilename zipfilecontents
Example:
zip -r myzip.zip c:\myfolder\*.*
The -r parameter includes subfolders as well.
Problem is that the complete folder structure is included in the zip. I have not found a solution for this yet.
To solve the structure folder problem, add a cd command that will target the folder container which has inside your file or files. This before running the code proposed by Martien de Jong upside.
for example:
The path of my file is: cd C:\aa\B\file.txt
So the path you will put in the cd to target the folder container is: cd C:\aa\B
cd C:\aa\B
zip -r myzip.zip B\*.*
*Remember that this code will zip all the files included in B folder.
Hi, I have many zip files located at g:\toto. These zips contain some files. I would like to extract all zip in a same directory (g:\toto\extracted) then rename various files of the zip.
Example 1 :
www_12567.vp.zip : 3 files : alpha.doc, beta.xls, teta.doc
I would like after extraction, files are renamed with the name of the zip
www_12567.vp.alpha.doc, www_12567.vp.beta.xls, www_12567.vp.teta.doc
Example 2 :
www_12.vp.zip : 3 files : al.doc, bea.xls, tta.doc
www_12.vp.al.doc, www_12.vp.bea.xls, www_12.vp.tta.doc
I found this question, but it talks about .txt and the zip contain one file, so, it doesn't work.
Without knowing the contents of the archive you can't know which files to rename, because you are putting them into a directory that may already contain other files.
This, however, would be much easier if there was a dedicated directory to put the files temporarily. Here's how you could use it:
#ECHO OFF
SET "srcdir=G:\toto"
SET "tgtdir=G:\toto\extracted"
SET "tmpdir=G:\toto\extracted-tmp"
FOR %%Z IN ("%srcdir%\*.zip") DO (
unpack "%%Z" with your favourite tool into "%tmpdir%"
FOR %%I IN ("%tmpdir%\*") DO MOVE "%%I" "%tgtdir%\%%~nZ.%%~nxI"
)
Of course, the temporary directory would need to be empty before running the batch file. You could add DEL "%tmpdir%\*" somewhere before the loop to make sure it is.
One other note is, the above assumes that the archives do not contain subdirectories or, at least, that the files are extracted without subdirectories.
UPDATE
If you are using the 7-Zip archiver to work with .zip files, then this is how your extract command might look:
7z e "%%Z" -o"%tmpdir%"
Disclaimer: I'm not an active user of 7-Zip. This is what I used as a reference to come up with the above command:
7-Zip Command-Line Examples
I have written a small batch file to move files from one folder to another folder.
copy E:\Source\Test.tif E:\Temp
Is there any way can I rename a file name after it has been moved to temp folder.Like
E:\Source:\TestInd1.tiff.
Please suggest.
You can do a move and a rename at the same time, yes:
move someFile S:\ome\Destination\newName