Why is it literally impossible to unzip files like this with a script inside a directory with multiple folders with the click of one button?
Why is it literally impossible to unzip files like this with a script inside a directory with multiple folders with the...
Other urls found in this thread:
stackoverflow.com
stackoverflow.com
stackoverflow.com
thewindowsclub.com
pastebin.com
twitter.com
If a script can't do it, write an executable that can
>not being able to write a script that does this shit
get out
you're not supposed to extract cbz files tho
Doesn't matter if it's zip or cbz, it's still impossible to recursicely extract it into a folder with the zip's name.
what do you think a cbz file is
for comic viewers
>, it's still impossible to recursicely extract it into a folder with the zip's name.
there is literally powershell code snippet on stackoverflow that does exactly this
>comic viewers
Really bad image viewers that have .zip support?
cbz literally stands for comic book zip
and they are more handy for reading
Any image reader is just as good.
The point I was making is comic book readers are stupid. Just use any old image reader, since it'll probably be better and more free.
none of it works
>more free.
wat?
into ze search he writes *.cbz
selects all niptoon archives, right clicks and chooses to extract to *
then he deletes said archives ezpz ok thank you
Man, it's been a while since I last had to write a batch script, but shouldn't something like this do the job?
@echo off
FOR /D %%A IN (*) DO (
cd "%%A"
FOR %%B IN (*.cbz) DO (
7za x "%%B"
del "%%B"
)
cd ..
)
no, because I have filenames with pipelines, brackets and weird unicode letters
ahhh, it's you again.
Well then you have shit file names. Whose fault is that
Windows.
>a C script is fundamentally different from a python/shell script
hmm
You have posted this thread every day for the last week.
You could have manually done this in that time.
# Use UNC path
>cd "\\?\C:\myshittyanime\"
>gci -Filter "*INVALID_CHAR*" -Recurse | % { Rename-Item -LiteralPath "$($_.FullName)" ($_.FullName -replace 'INVALID_CHAR','WHATEVER') }
wow
To clarify on this, windows support is kinda shitty, some programs support long paths/unicode in paths, other programs don't. Powershell with UNC paths DOES support everything that can exist AFAIK - eg, if some program was able to create/name it, that will be able to work with it.
i'll paypal or send crypto in $30 if you can make a script
this
how hard is this, OP. i prefer winrar though, the extract options are better
I already posted a powershell snippit above that you could use as a template, what's wrong with it? What are the bad characters you have and what do you want them replaced with?
Use Powershell or WSL, I'm pretty sure you can do this with a single command
I don't want to replace anything. I just want to make sure every zip extracts its content to a folder with the name of the zip in its current folder and then it gets rid of the zip and moves on to the next zip.
Comic viewers still unpack archives in memory or a temp directory. The only advantage is size reduction, and handling of metadata formats that nobody uses.
retard use the search function in explorer
Does this work?
What's wrong with the scripts people have posted for you on previous days?
OP is a faggot
Oh, and if you want to get fancy
They were either
1. for Linux, I'm not installing a distro to do basic shit.
2. didn't work
Then write your own. Python is easy as fuck and you could probably create some Frankenstein that does exactly what you want.
Don't use python, just use powershell.
>a compiled language is not fundamentally different from an interpreted one
>languages are either compiled or interpreted, rather than implimentations
I realize you're probably just wasting people's time for lols but here you go, should work as is if the 7zip path and extensions are correct.
# Ensure your 7z path is correct here
$7z = 'C:\Program Files\7-Zip\7z.exe';
# Any other extensions you want to catch?
$exts = @('.cba','.7z','.zip');
# Specify the parent folder in UNC style here;
cd "\\?\C:\MyYaoiComicBooks";
$files = (gci -Recurse | ? { $exts -contains $_.Extension});
Write-Host "Extracting the following files matching ($exts)...";
$files | % {
$dst = "$(($_.FullName))_Extracted";
mkdir $dst -ErrorAction Ignore;
cd $dst;
echo "&$7z x `"$($_.FullName)`"";
&$7z x "$($_.FullName)";
remove-item -LiteralPath $_.FullName;
};
This stupid thread again...
I'm not actually trolling, I 'll get back at you tomorrow after work to see if the script works
Actually I decided to try it and it doesn't work. It says some paths can't be found and it's extracting everything in one folder. I want it to be extracted like in my webm. The zip gets extracted to a folder with the zip's name and the zip gets deleted afterwards and then it moves on to the next zip.
actually was going the other way myself, zipping up directories.
easy to do with find
If you truly arent trolling try posting actual error messages and the dir tree it creates.
The directory is at E:\1
# Ensure your 7z path is correct here
$7z = 'C:\Program Files\7-Zip\7z.exe';
# Any other extensions you want to catch?
$exts = @('.cbz','.7z','.zip');
# Specify the parent folder in UNC style here;
cd "\\?\E:\1";
$files = (gci -Recurse | ? { $exts -contains $_.Extension});
Write-Host "Extracting the following files matching ($exts)...";
$files | % {
$dst = "$(($_.FullName))_Extracted";
mkdir $dst -ErrorAction Ignore;
cd $dst;
echo "&$7z x `"$($_.FullName)`"";
&$7z x "$($_.FullName)";
remove-item -LiteralPath $_.FullName;
};
Alright, that was my fuckup.
CD was failing due to i missed a -LiteralPath (necessary for these fucked up paths). Try
# Ensure your 7z path is correct here
$7z = 'C:\Program Files\7-Zip\7z.exe';
# Any other extensions you want to catch?
$exts = @('.cbz','.7z','.zip');
# Specify the parent folder in UNC style here;
cd "\\?\D:\inc\test123";
$files = (gci -Recurse | ? { $exts -contains $_.Extension});
Write-Host "Extracting the following files matching ($exts)...";
$files | % {
$dst = "$(($_.FullName))_Extracted";
mkdir $dst -ErrorAction Ignore;
cd -LiteralPath $dst;
echo "&$7z x `"$($_.FullName)`"";
&$7z x "$($_.FullName)";
remove-item -LiteralPath $_.FullName;
};
it works, thank you so much
is there a chance for it to skip a zip or accidentally delete a zip before extracting it
What's wrong with using 7zip to extract the whole directory?
how
Exactly how op did in the webm
install gentoo
There is a chance 7zip could fail, try this if you want better messaging and for it to only delete the files on success.
# Ensure your 7z path is correct here
$7z = 'C:\Program Files\7-Zip\7z.exe';
# Any other extensions you want to catch?
$exts = @('.cbz','.7z','.zip');
# Specify the parent folder in UNC style here;
$parent = "\\?\D:\inc\test123";
cd $parent;
$files = (gci -Recurse | ? { $exts -contains $_.Extension});
Write-Host "Extracting the following files matching ($exts)...";
$files | % {
$dst = "$(($_.FullName))_Extracted";
mkdir $dst -ErrorAction Ignore > null;
cd -LiteralPath $dst;
&$7z x "$($_.FullName)" > null;
if ($LASTEXITCODE -eq 0) {
remove-item -LiteralPath $_.FullName;
write-host -ForegroundColor Green "Extracted and removing archive: $($_.FullName))";
} else {
write-host -ForegroundColor Red "Error extracting archive, skipping removal: ($($_.FullName))";
cd $parent;
remove-item -LiteralPath $dst -Recurse -Confirm:$false -ErrorAction Ignore;
}
};
Why are you extracting cbz's? The entire purpose of them is to be used with a comic book viewer.
There's your problem.
wow
Why can't you unzip multiple folders at once, creating a separate folder for each folder unzipped? It always puts all the unzipped folders into one folder.
>Andou Hiroyuki
Because you have hit the end of what GUIs are good for. GUI is great if you want to do a task that the developer has thought of. This is not one of those.
Command line lets you make mini-programs to perform complex actions that you describe to the computer.
I'm pretty sure its possible with Directory Opus
or with a bash script.
Honestly the biggest part of the effort would be rendering the GUI to have the button to click.
Yes.
However that doesn't mean that there is no reason not to open them. They are just zip files with the extention changed. I open them to remove credit pages or add in proper cover images.
The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block,
or a CommandInfo object.
At F:\1\2\xd2.ps1:14 char:6
+ &$7z x "$($_.FullName)" > null;
+ ~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : BadExpression
I got this error with that script
>I open them to remove credit pages or add in proper cover images.
I was under the impression that you can do that without extracting them. There are still valid reasons to extract them though.
If you can I don't know how or have a viewer that can.
Not sure what the issue here is, just try removing the
> null
from the offending line, it's just there to clean up the output, its not necessary.
oh, maybe it's parsing in a weird way (not sure why PS would do that.) you could try this modification
(&$7z x "$($_.FullName)") > null;
It's not literally impossible. You're just a lazy ass and want people to do your work for you.
Why are you extracting CBZs
The whole point of renaming ZIPs to CBZ is to open them in a reader without extracting them