You do not mention the type of your archives but from your example I assume that you use RAR files on Windows.
First you must create a temporary folder (eg. C:\TempDir
) where you will do your job.
After this, you can use the following procedure:
- extract all the files without their paths in
TempDir
:
rar e lossless.rar C:\TempDir\
- delete the original archive: (BE SURE TO HAVE A BACKUP!)
del /Q lossless.rar
- add the files back without the path info: (otherwise you'll end up with c:\tempDir in your archive and you don't want that)
rar a -ep lossless.rar c:\TempDir\*
Of course, if you have a lot of archives you can automate the above steps by putting them in a batch file (eg. RemoveRarPaths.cmd
) and have the archive name as a parameter. Then you can use it with RemoveRarPaths.cmd myRar.rar
or more powerful: RemoveRarPaths *.rar
For your convenience the batch file should look something like:
rar e %1 c:\tempDir\
del /Q %1
rar a -ep %1 c:\tempDir\*
DISCLAIMER> Written from top of the head - not tested, no error handling, parameter checking etc. - just to show you the idea. Be sure to have backups & use at your own risk.