Extract multipart rar, deleting parts as they are extracted
up vote
1
down vote
favorite
I have a multipart rar of 80GB unpacked. I have 5GB of free space, and every part of the rar archive is 2GB.
What I'm looking for is to extract one part, delete it, extract the next, and so on, as to use at most 5 more GB in the extraction process and not exhaust all my disk space.
windows compression rar
add a comment |
up vote
1
down vote
favorite
I have a multipart rar of 80GB unpacked. I have 5GB of free space, and every part of the rar archive is 2GB.
What I'm looking for is to extract one part, delete it, extract the next, and so on, as to use at most 5 more GB in the extraction process and not exhaust all my disk space.
windows compression rar
What did you already try?
– Hennes
Jan 26 '16 at 16:59
I tried searching on the net and on superuser :p I have no idea what software I could use. 7zip seems to not delete anything ever, and winrar seems to only delete if everything was successful, so all files at once. If I can't find a solution I will have to write it myself in python, which is bad since I'm almost certainly going to ruin the archive and have to redownload it a bunch of times :)
– m fran
Jan 26 '16 at 17:11
You can make a small archive and run your scripts on that with configurable size limits before you go full scale. Also, as far as I know, unrar allows for single-file extraction without the need to unpack the whole archive, so you can search the list (use l switch) to find the file(s).
– Yorik
Jan 26 '16 at 18:34
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have a multipart rar of 80GB unpacked. I have 5GB of free space, and every part of the rar archive is 2GB.
What I'm looking for is to extract one part, delete it, extract the next, and so on, as to use at most 5 more GB in the extraction process and not exhaust all my disk space.
windows compression rar
I have a multipart rar of 80GB unpacked. I have 5GB of free space, and every part of the rar archive is 2GB.
What I'm looking for is to extract one part, delete it, extract the next, and so on, as to use at most 5 more GB in the extraction process and not exhaust all my disk space.
windows compression rar
windows compression rar
edited Jan 26 '16 at 17:09
asked Jan 26 '16 at 16:49
m fran
155
155
What did you already try?
– Hennes
Jan 26 '16 at 16:59
I tried searching on the net and on superuser :p I have no idea what software I could use. 7zip seems to not delete anything ever, and winrar seems to only delete if everything was successful, so all files at once. If I can't find a solution I will have to write it myself in python, which is bad since I'm almost certainly going to ruin the archive and have to redownload it a bunch of times :)
– m fran
Jan 26 '16 at 17:11
You can make a small archive and run your scripts on that with configurable size limits before you go full scale. Also, as far as I know, unrar allows for single-file extraction without the need to unpack the whole archive, so you can search the list (use l switch) to find the file(s).
– Yorik
Jan 26 '16 at 18:34
add a comment |
What did you already try?
– Hennes
Jan 26 '16 at 16:59
I tried searching on the net and on superuser :p I have no idea what software I could use. 7zip seems to not delete anything ever, and winrar seems to only delete if everything was successful, so all files at once. If I can't find a solution I will have to write it myself in python, which is bad since I'm almost certainly going to ruin the archive and have to redownload it a bunch of times :)
– m fran
Jan 26 '16 at 17:11
You can make a small archive and run your scripts on that with configurable size limits before you go full scale. Also, as far as I know, unrar allows for single-file extraction without the need to unpack the whole archive, so you can search the list (use l switch) to find the file(s).
– Yorik
Jan 26 '16 at 18:34
What did you already try?
– Hennes
Jan 26 '16 at 16:59
What did you already try?
– Hennes
Jan 26 '16 at 16:59
I tried searching on the net and on superuser :p I have no idea what software I could use. 7zip seems to not delete anything ever, and winrar seems to only delete if everything was successful, so all files at once. If I can't find a solution I will have to write it myself in python, which is bad since I'm almost certainly going to ruin the archive and have to redownload it a bunch of times :)
– m fran
Jan 26 '16 at 17:11
I tried searching on the net and on superuser :p I have no idea what software I could use. 7zip seems to not delete anything ever, and winrar seems to only delete if everything was successful, so all files at once. If I can't find a solution I will have to write it myself in python, which is bad since I'm almost certainly going to ruin the archive and have to redownload it a bunch of times :)
– m fran
Jan 26 '16 at 17:11
You can make a small archive and run your scripts on that with configurable size limits before you go full scale. Also, as far as I know, unrar allows for single-file extraction without the need to unpack the whole archive, so you can search the list (use l switch) to find the file(s).
– Yorik
Jan 26 '16 at 18:34
You can make a small archive and run your scripts on that with configurable size limits before you go full scale. Also, as far as I know, unrar allows for single-file extraction without the need to unpack the whole archive, so you can search the list (use l switch) to find the file(s).
– Yorik
Jan 26 '16 at 18:34
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
IMPORTANT:
- this script WILL delete the parts done extracting regardless of the end result, so if the process stops for a missing or corrupted part, you would not be able to start over
- Open notepad and paste the following code and save it as _unrar.vbs in the same folder with your rar files.
- Set UnRAR_Full_Path, First_Part and Target_Folder, make sure to keep the quotes.
The Script:
UnRAR_Full_Path = "c:program fileswinrarunrar.exe"
First_Part = "YourArchiveName.part001.rar"
Target_Folder = "ExtractedFiles"
mf_command = AddQuotes(UnRAR_Full_Path) & " x " & AddQuotes(First_Part) & " " & AddQuotes(Target_Folder)
mf_LZerosSplit = Split(First_Part, ".")
mf_LZerosPart = Mid(mf_LZerosSplit(UBound(mf_LZerosSplit)-1), 5)
If UBound(mf_LZerosSplit) > 3 Then
WScript.Echo ("Too Lazy to deal with names the contains dots, only 2 are allowed. one before 'part' and one before 'rar'")
WScript.Quit 1
End If
mf_LZ_UnderTen = ""
mf_LZ_UnderHundred = ""
mf_LZ_UnderThousand = ""
If Len(mf_LZerosPart) = 2 Then
mf_LZ_UnderTen = "0"
ElseIf Len(mf_LZerosPart) = 3 Then
mf_LZ_UnderTen = "00"
mf_LZ_UnderHundred = "0"
ElseIf Len(mf_LZerosPart) = 4 Then
mf_LZ_UnderTen = "000"
mf_LZ_UnderHundred = "00"
mf_LZ_UnderThousand = "0"
End If
Set objShell = CreateObject("WScript.Shell")
Set objWshScriptExec = objShell.Exec(mf_command)
Set objStdOut = objWshScriptExec.StdOut
While Not objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
'WScript.Echo (strLine)
If InStr(strLine,"Extracting from") Then
mf_filename = Mid(strLine, 17)
mf_partnameSplit = Split(mf_filename, ".")
mf_partname = mf_partnameSplit(1)
mf_partnumber = Mid(mf_partname , 5)
If mf_partnumber > 1 Then
mf_numtodel = mf_partnumber-1
mf_LeadingZeros = ""
If mf_numtodel < 10 Then
mf_LeadingZeros = mf_LZ_UnderTen
ElseIf mf_numtodel < 100 Then
mf_LeadingZeros = mf_LZ_UnderHundred
ElseIf mf_numtodel < 1000 Then
mf_LeadingZeros = mf_LZ_UnderThousand
End If
mf_filetodel = mf_partnameSplit(0) & ".part" & mf_LeadingZeros & mf_numtodel & ".rar"
'WScript.Echo ("NOW DELETING: " & mf_filetodel)
Set obj = CreateObject("Scripting.FileSystemObject")
obj.DeleteFile(mf_filetodel)
End If
ElseIf InStr(strLine,"All OK") Then
WScript.Echo ("looks like All Ok, Delete the Last part and Have a nice day :)")
End If
Wend
Function AddQuotes(strInput)
AddQuotes = Chr(34) & strInput & Chr(34)
End Function
Option one: Silent
run the _unrar.vbs file by double clicking it
Option two: Recommended
remove the ' from the start of
'WScript.Echo (strLine)
'WScript.Echo ("Deleting: " & mf_filetodel)
open cmd, direct to your folder and type "cscript _unrar.vbs"
- using WScript.Echo without cscript will popup too many annoying message boxes
this script works by reading the Stdout of UnRAR.exe.
EDIT
Improved the script to automatically work with any name structure and with any number of parts up to 9999 parts. and to work with legacy archives that does not contain leading zeros.
wow, thanks. I'll run this as soon as the download finishes completely. I do understand the consequences of the script, but in my case, if I do goof up, I can redownload the archive from the server as many times as I want, so no worries there.
– m fran
Jan 27 '16 at 9:13
Actually, could you change it to work for <100 archives? My idea was to delete the two lines starting at elseif and change ".part00" to ".part0" but if possible I'd like to avoid redownloading everything because I tried changing a program in a language I don't understand :)
– m fran
Jan 27 '16 at 9:21
I added what you'll need to change for Parts < 100.
– Maher Fattouh
Jan 27 '16 at 11:47
Thanks a ton, still waiting for the download to finish. I will let you know if this works!
– m fran
Jan 27 '16 at 12:00
1
No problem, I tested the script and it should work just perfect :) , good luck
– Maher Fattouh
Jan 27 '16 at 12:02
|
show 2 more comments
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1031625%2fextract-multipart-rar-deleting-parts-as-they-are-extracted%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
IMPORTANT:
- this script WILL delete the parts done extracting regardless of the end result, so if the process stops for a missing or corrupted part, you would not be able to start over
- Open notepad and paste the following code and save it as _unrar.vbs in the same folder with your rar files.
- Set UnRAR_Full_Path, First_Part and Target_Folder, make sure to keep the quotes.
The Script:
UnRAR_Full_Path = "c:program fileswinrarunrar.exe"
First_Part = "YourArchiveName.part001.rar"
Target_Folder = "ExtractedFiles"
mf_command = AddQuotes(UnRAR_Full_Path) & " x " & AddQuotes(First_Part) & " " & AddQuotes(Target_Folder)
mf_LZerosSplit = Split(First_Part, ".")
mf_LZerosPart = Mid(mf_LZerosSplit(UBound(mf_LZerosSplit)-1), 5)
If UBound(mf_LZerosSplit) > 3 Then
WScript.Echo ("Too Lazy to deal with names the contains dots, only 2 are allowed. one before 'part' and one before 'rar'")
WScript.Quit 1
End If
mf_LZ_UnderTen = ""
mf_LZ_UnderHundred = ""
mf_LZ_UnderThousand = ""
If Len(mf_LZerosPart) = 2 Then
mf_LZ_UnderTen = "0"
ElseIf Len(mf_LZerosPart) = 3 Then
mf_LZ_UnderTen = "00"
mf_LZ_UnderHundred = "0"
ElseIf Len(mf_LZerosPart) = 4 Then
mf_LZ_UnderTen = "000"
mf_LZ_UnderHundred = "00"
mf_LZ_UnderThousand = "0"
End If
Set objShell = CreateObject("WScript.Shell")
Set objWshScriptExec = objShell.Exec(mf_command)
Set objStdOut = objWshScriptExec.StdOut
While Not objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
'WScript.Echo (strLine)
If InStr(strLine,"Extracting from") Then
mf_filename = Mid(strLine, 17)
mf_partnameSplit = Split(mf_filename, ".")
mf_partname = mf_partnameSplit(1)
mf_partnumber = Mid(mf_partname , 5)
If mf_partnumber > 1 Then
mf_numtodel = mf_partnumber-1
mf_LeadingZeros = ""
If mf_numtodel < 10 Then
mf_LeadingZeros = mf_LZ_UnderTen
ElseIf mf_numtodel < 100 Then
mf_LeadingZeros = mf_LZ_UnderHundred
ElseIf mf_numtodel < 1000 Then
mf_LeadingZeros = mf_LZ_UnderThousand
End If
mf_filetodel = mf_partnameSplit(0) & ".part" & mf_LeadingZeros & mf_numtodel & ".rar"
'WScript.Echo ("NOW DELETING: " & mf_filetodel)
Set obj = CreateObject("Scripting.FileSystemObject")
obj.DeleteFile(mf_filetodel)
End If
ElseIf InStr(strLine,"All OK") Then
WScript.Echo ("looks like All Ok, Delete the Last part and Have a nice day :)")
End If
Wend
Function AddQuotes(strInput)
AddQuotes = Chr(34) & strInput & Chr(34)
End Function
Option one: Silent
run the _unrar.vbs file by double clicking it
Option two: Recommended
remove the ' from the start of
'WScript.Echo (strLine)
'WScript.Echo ("Deleting: " & mf_filetodel)
open cmd, direct to your folder and type "cscript _unrar.vbs"
- using WScript.Echo without cscript will popup too many annoying message boxes
this script works by reading the Stdout of UnRAR.exe.
EDIT
Improved the script to automatically work with any name structure and with any number of parts up to 9999 parts. and to work with legacy archives that does not contain leading zeros.
wow, thanks. I'll run this as soon as the download finishes completely. I do understand the consequences of the script, but in my case, if I do goof up, I can redownload the archive from the server as many times as I want, so no worries there.
– m fran
Jan 27 '16 at 9:13
Actually, could you change it to work for <100 archives? My idea was to delete the two lines starting at elseif and change ".part00" to ".part0" but if possible I'd like to avoid redownloading everything because I tried changing a program in a language I don't understand :)
– m fran
Jan 27 '16 at 9:21
I added what you'll need to change for Parts < 100.
– Maher Fattouh
Jan 27 '16 at 11:47
Thanks a ton, still waiting for the download to finish. I will let you know if this works!
– m fran
Jan 27 '16 at 12:00
1
No problem, I tested the script and it should work just perfect :) , good luck
– Maher Fattouh
Jan 27 '16 at 12:02
|
show 2 more comments
up vote
2
down vote
accepted
IMPORTANT:
- this script WILL delete the parts done extracting regardless of the end result, so if the process stops for a missing or corrupted part, you would not be able to start over
- Open notepad and paste the following code and save it as _unrar.vbs in the same folder with your rar files.
- Set UnRAR_Full_Path, First_Part and Target_Folder, make sure to keep the quotes.
The Script:
UnRAR_Full_Path = "c:program fileswinrarunrar.exe"
First_Part = "YourArchiveName.part001.rar"
Target_Folder = "ExtractedFiles"
mf_command = AddQuotes(UnRAR_Full_Path) & " x " & AddQuotes(First_Part) & " " & AddQuotes(Target_Folder)
mf_LZerosSplit = Split(First_Part, ".")
mf_LZerosPart = Mid(mf_LZerosSplit(UBound(mf_LZerosSplit)-1), 5)
If UBound(mf_LZerosSplit) > 3 Then
WScript.Echo ("Too Lazy to deal with names the contains dots, only 2 are allowed. one before 'part' and one before 'rar'")
WScript.Quit 1
End If
mf_LZ_UnderTen = ""
mf_LZ_UnderHundred = ""
mf_LZ_UnderThousand = ""
If Len(mf_LZerosPart) = 2 Then
mf_LZ_UnderTen = "0"
ElseIf Len(mf_LZerosPart) = 3 Then
mf_LZ_UnderTen = "00"
mf_LZ_UnderHundred = "0"
ElseIf Len(mf_LZerosPart) = 4 Then
mf_LZ_UnderTen = "000"
mf_LZ_UnderHundred = "00"
mf_LZ_UnderThousand = "0"
End If
Set objShell = CreateObject("WScript.Shell")
Set objWshScriptExec = objShell.Exec(mf_command)
Set objStdOut = objWshScriptExec.StdOut
While Not objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
'WScript.Echo (strLine)
If InStr(strLine,"Extracting from") Then
mf_filename = Mid(strLine, 17)
mf_partnameSplit = Split(mf_filename, ".")
mf_partname = mf_partnameSplit(1)
mf_partnumber = Mid(mf_partname , 5)
If mf_partnumber > 1 Then
mf_numtodel = mf_partnumber-1
mf_LeadingZeros = ""
If mf_numtodel < 10 Then
mf_LeadingZeros = mf_LZ_UnderTen
ElseIf mf_numtodel < 100 Then
mf_LeadingZeros = mf_LZ_UnderHundred
ElseIf mf_numtodel < 1000 Then
mf_LeadingZeros = mf_LZ_UnderThousand
End If
mf_filetodel = mf_partnameSplit(0) & ".part" & mf_LeadingZeros & mf_numtodel & ".rar"
'WScript.Echo ("NOW DELETING: " & mf_filetodel)
Set obj = CreateObject("Scripting.FileSystemObject")
obj.DeleteFile(mf_filetodel)
End If
ElseIf InStr(strLine,"All OK") Then
WScript.Echo ("looks like All Ok, Delete the Last part and Have a nice day :)")
End If
Wend
Function AddQuotes(strInput)
AddQuotes = Chr(34) & strInput & Chr(34)
End Function
Option one: Silent
run the _unrar.vbs file by double clicking it
Option two: Recommended
remove the ' from the start of
'WScript.Echo (strLine)
'WScript.Echo ("Deleting: " & mf_filetodel)
open cmd, direct to your folder and type "cscript _unrar.vbs"
- using WScript.Echo without cscript will popup too many annoying message boxes
this script works by reading the Stdout of UnRAR.exe.
EDIT
Improved the script to automatically work with any name structure and with any number of parts up to 9999 parts. and to work with legacy archives that does not contain leading zeros.
wow, thanks. I'll run this as soon as the download finishes completely. I do understand the consequences of the script, but in my case, if I do goof up, I can redownload the archive from the server as many times as I want, so no worries there.
– m fran
Jan 27 '16 at 9:13
Actually, could you change it to work for <100 archives? My idea was to delete the two lines starting at elseif and change ".part00" to ".part0" but if possible I'd like to avoid redownloading everything because I tried changing a program in a language I don't understand :)
– m fran
Jan 27 '16 at 9:21
I added what you'll need to change for Parts < 100.
– Maher Fattouh
Jan 27 '16 at 11:47
Thanks a ton, still waiting for the download to finish. I will let you know if this works!
– m fran
Jan 27 '16 at 12:00
1
No problem, I tested the script and it should work just perfect :) , good luck
– Maher Fattouh
Jan 27 '16 at 12:02
|
show 2 more comments
up vote
2
down vote
accepted
up vote
2
down vote
accepted
IMPORTANT:
- this script WILL delete the parts done extracting regardless of the end result, so if the process stops for a missing or corrupted part, you would not be able to start over
- Open notepad and paste the following code and save it as _unrar.vbs in the same folder with your rar files.
- Set UnRAR_Full_Path, First_Part and Target_Folder, make sure to keep the quotes.
The Script:
UnRAR_Full_Path = "c:program fileswinrarunrar.exe"
First_Part = "YourArchiveName.part001.rar"
Target_Folder = "ExtractedFiles"
mf_command = AddQuotes(UnRAR_Full_Path) & " x " & AddQuotes(First_Part) & " " & AddQuotes(Target_Folder)
mf_LZerosSplit = Split(First_Part, ".")
mf_LZerosPart = Mid(mf_LZerosSplit(UBound(mf_LZerosSplit)-1), 5)
If UBound(mf_LZerosSplit) > 3 Then
WScript.Echo ("Too Lazy to deal with names the contains dots, only 2 are allowed. one before 'part' and one before 'rar'")
WScript.Quit 1
End If
mf_LZ_UnderTen = ""
mf_LZ_UnderHundred = ""
mf_LZ_UnderThousand = ""
If Len(mf_LZerosPart) = 2 Then
mf_LZ_UnderTen = "0"
ElseIf Len(mf_LZerosPart) = 3 Then
mf_LZ_UnderTen = "00"
mf_LZ_UnderHundred = "0"
ElseIf Len(mf_LZerosPart) = 4 Then
mf_LZ_UnderTen = "000"
mf_LZ_UnderHundred = "00"
mf_LZ_UnderThousand = "0"
End If
Set objShell = CreateObject("WScript.Shell")
Set objWshScriptExec = objShell.Exec(mf_command)
Set objStdOut = objWshScriptExec.StdOut
While Not objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
'WScript.Echo (strLine)
If InStr(strLine,"Extracting from") Then
mf_filename = Mid(strLine, 17)
mf_partnameSplit = Split(mf_filename, ".")
mf_partname = mf_partnameSplit(1)
mf_partnumber = Mid(mf_partname , 5)
If mf_partnumber > 1 Then
mf_numtodel = mf_partnumber-1
mf_LeadingZeros = ""
If mf_numtodel < 10 Then
mf_LeadingZeros = mf_LZ_UnderTen
ElseIf mf_numtodel < 100 Then
mf_LeadingZeros = mf_LZ_UnderHundred
ElseIf mf_numtodel < 1000 Then
mf_LeadingZeros = mf_LZ_UnderThousand
End If
mf_filetodel = mf_partnameSplit(0) & ".part" & mf_LeadingZeros & mf_numtodel & ".rar"
'WScript.Echo ("NOW DELETING: " & mf_filetodel)
Set obj = CreateObject("Scripting.FileSystemObject")
obj.DeleteFile(mf_filetodel)
End If
ElseIf InStr(strLine,"All OK") Then
WScript.Echo ("looks like All Ok, Delete the Last part and Have a nice day :)")
End If
Wend
Function AddQuotes(strInput)
AddQuotes = Chr(34) & strInput & Chr(34)
End Function
Option one: Silent
run the _unrar.vbs file by double clicking it
Option two: Recommended
remove the ' from the start of
'WScript.Echo (strLine)
'WScript.Echo ("Deleting: " & mf_filetodel)
open cmd, direct to your folder and type "cscript _unrar.vbs"
- using WScript.Echo without cscript will popup too many annoying message boxes
this script works by reading the Stdout of UnRAR.exe.
EDIT
Improved the script to automatically work with any name structure and with any number of parts up to 9999 parts. and to work with legacy archives that does not contain leading zeros.
IMPORTANT:
- this script WILL delete the parts done extracting regardless of the end result, so if the process stops for a missing or corrupted part, you would not be able to start over
- Open notepad and paste the following code and save it as _unrar.vbs in the same folder with your rar files.
- Set UnRAR_Full_Path, First_Part and Target_Folder, make sure to keep the quotes.
The Script:
UnRAR_Full_Path = "c:program fileswinrarunrar.exe"
First_Part = "YourArchiveName.part001.rar"
Target_Folder = "ExtractedFiles"
mf_command = AddQuotes(UnRAR_Full_Path) & " x " & AddQuotes(First_Part) & " " & AddQuotes(Target_Folder)
mf_LZerosSplit = Split(First_Part, ".")
mf_LZerosPart = Mid(mf_LZerosSplit(UBound(mf_LZerosSplit)-1), 5)
If UBound(mf_LZerosSplit) > 3 Then
WScript.Echo ("Too Lazy to deal with names the contains dots, only 2 are allowed. one before 'part' and one before 'rar'")
WScript.Quit 1
End If
mf_LZ_UnderTen = ""
mf_LZ_UnderHundred = ""
mf_LZ_UnderThousand = ""
If Len(mf_LZerosPart) = 2 Then
mf_LZ_UnderTen = "0"
ElseIf Len(mf_LZerosPart) = 3 Then
mf_LZ_UnderTen = "00"
mf_LZ_UnderHundred = "0"
ElseIf Len(mf_LZerosPart) = 4 Then
mf_LZ_UnderTen = "000"
mf_LZ_UnderHundred = "00"
mf_LZ_UnderThousand = "0"
End If
Set objShell = CreateObject("WScript.Shell")
Set objWshScriptExec = objShell.Exec(mf_command)
Set objStdOut = objWshScriptExec.StdOut
While Not objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
'WScript.Echo (strLine)
If InStr(strLine,"Extracting from") Then
mf_filename = Mid(strLine, 17)
mf_partnameSplit = Split(mf_filename, ".")
mf_partname = mf_partnameSplit(1)
mf_partnumber = Mid(mf_partname , 5)
If mf_partnumber > 1 Then
mf_numtodel = mf_partnumber-1
mf_LeadingZeros = ""
If mf_numtodel < 10 Then
mf_LeadingZeros = mf_LZ_UnderTen
ElseIf mf_numtodel < 100 Then
mf_LeadingZeros = mf_LZ_UnderHundred
ElseIf mf_numtodel < 1000 Then
mf_LeadingZeros = mf_LZ_UnderThousand
End If
mf_filetodel = mf_partnameSplit(0) & ".part" & mf_LeadingZeros & mf_numtodel & ".rar"
'WScript.Echo ("NOW DELETING: " & mf_filetodel)
Set obj = CreateObject("Scripting.FileSystemObject")
obj.DeleteFile(mf_filetodel)
End If
ElseIf InStr(strLine,"All OK") Then
WScript.Echo ("looks like All Ok, Delete the Last part and Have a nice day :)")
End If
Wend
Function AddQuotes(strInput)
AddQuotes = Chr(34) & strInput & Chr(34)
End Function
Option one: Silent
run the _unrar.vbs file by double clicking it
Option two: Recommended
remove the ' from the start of
'WScript.Echo (strLine)
'WScript.Echo ("Deleting: " & mf_filetodel)
open cmd, direct to your folder and type "cscript _unrar.vbs"
- using WScript.Echo without cscript will popup too many annoying message boxes
this script works by reading the Stdout of UnRAR.exe.
EDIT
Improved the script to automatically work with any name structure and with any number of parts up to 9999 parts. and to work with legacy archives that does not contain leading zeros.
edited Oct 30 at 3:44
phuclv
8,88063788
8,88063788
answered Jan 27 '16 at 0:16
Maher Fattouh
610311
610311
wow, thanks. I'll run this as soon as the download finishes completely. I do understand the consequences of the script, but in my case, if I do goof up, I can redownload the archive from the server as many times as I want, so no worries there.
– m fran
Jan 27 '16 at 9:13
Actually, could you change it to work for <100 archives? My idea was to delete the two lines starting at elseif and change ".part00" to ".part0" but if possible I'd like to avoid redownloading everything because I tried changing a program in a language I don't understand :)
– m fran
Jan 27 '16 at 9:21
I added what you'll need to change for Parts < 100.
– Maher Fattouh
Jan 27 '16 at 11:47
Thanks a ton, still waiting for the download to finish. I will let you know if this works!
– m fran
Jan 27 '16 at 12:00
1
No problem, I tested the script and it should work just perfect :) , good luck
– Maher Fattouh
Jan 27 '16 at 12:02
|
show 2 more comments
wow, thanks. I'll run this as soon as the download finishes completely. I do understand the consequences of the script, but in my case, if I do goof up, I can redownload the archive from the server as many times as I want, so no worries there.
– m fran
Jan 27 '16 at 9:13
Actually, could you change it to work for <100 archives? My idea was to delete the two lines starting at elseif and change ".part00" to ".part0" but if possible I'd like to avoid redownloading everything because I tried changing a program in a language I don't understand :)
– m fran
Jan 27 '16 at 9:21
I added what you'll need to change for Parts < 100.
– Maher Fattouh
Jan 27 '16 at 11:47
Thanks a ton, still waiting for the download to finish. I will let you know if this works!
– m fran
Jan 27 '16 at 12:00
1
No problem, I tested the script and it should work just perfect :) , good luck
– Maher Fattouh
Jan 27 '16 at 12:02
wow, thanks. I'll run this as soon as the download finishes completely. I do understand the consequences of the script, but in my case, if I do goof up, I can redownload the archive from the server as many times as I want, so no worries there.
– m fran
Jan 27 '16 at 9:13
wow, thanks. I'll run this as soon as the download finishes completely. I do understand the consequences of the script, but in my case, if I do goof up, I can redownload the archive from the server as many times as I want, so no worries there.
– m fran
Jan 27 '16 at 9:13
Actually, could you change it to work for <100 archives? My idea was to delete the two lines starting at elseif and change ".part00" to ".part0" but if possible I'd like to avoid redownloading everything because I tried changing a program in a language I don't understand :)
– m fran
Jan 27 '16 at 9:21
Actually, could you change it to work for <100 archives? My idea was to delete the two lines starting at elseif and change ".part00" to ".part0" but if possible I'd like to avoid redownloading everything because I tried changing a program in a language I don't understand :)
– m fran
Jan 27 '16 at 9:21
I added what you'll need to change for Parts < 100.
– Maher Fattouh
Jan 27 '16 at 11:47
I added what you'll need to change for Parts < 100.
– Maher Fattouh
Jan 27 '16 at 11:47
Thanks a ton, still waiting for the download to finish. I will let you know if this works!
– m fran
Jan 27 '16 at 12:00
Thanks a ton, still waiting for the download to finish. I will let you know if this works!
– m fran
Jan 27 '16 at 12:00
1
1
No problem, I tested the script and it should work just perfect :) , good luck
– Maher Fattouh
Jan 27 '16 at 12:02
No problem, I tested the script and it should work just perfect :) , good luck
– Maher Fattouh
Jan 27 '16 at 12:02
|
show 2 more comments
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1031625%2fextract-multipart-rar-deleting-parts-as-they-are-extracted%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What did you already try?
– Hennes
Jan 26 '16 at 16:59
I tried searching on the net and on superuser :p I have no idea what software I could use. 7zip seems to not delete anything ever, and winrar seems to only delete if everything was successful, so all files at once. If I can't find a solution I will have to write it myself in python, which is bad since I'm almost certainly going to ruin the archive and have to redownload it a bunch of times :)
– m fran
Jan 26 '16 at 17:11
You can make a small archive and run your scripts on that with configurable size limits before you go full scale. Also, as far as I know, unrar allows for single-file extraction without the need to unpack the whole archive, so you can search the list (use l switch) to find the file(s).
– Yorik
Jan 26 '16 at 18:34