0

I have some archive files and in each file there is a subfolder. I want to move files from subfolders to root folder of archive files and delete subfolders.

for example:

in lossless.rar
\my music\love.mp3
--->
\love.mp3

Hope someone know a solution. Thank you.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.