本帖最后由 zaqmlp 于 2019-8-29 20:57 编辑
| <div class="calibre3">本书由“<a href="http://epubw.com" class="calibre1">ePUBw.COM</a>”整理,<a href="http://epubw.com" class="calibre1">ePUBw.COM</a> 提供最新最全的优质电子书下载!!!</div> | | --------------------------- | | <div class="calibre2">本书由“<a href="http://epubw.com" class="calibre1">ePUBw.COM</a>”整理,<a href="http://epubw.com" class="calibre1">ePUBw.COM</a> 提供最新最全的优质电子书下载!!!</div> | | --------------------------- | | <div class="calibre5">本书由“<a href="http://epubw.com" class="calibre1">ePUBw.COM</a>”整理,<a href="http://epubw.com" class="calibre1">ePUBw.COM</a> 提供最新最全的优质电子书下载!!!</div>COPY |
新建一个utf-8编码的叫“删除.txt”的文本,将要删除的内容按上面格式填入;将txt、bat跟epub放一起运行,需安装winrar,并在代码中指定好安装路径 | < | | @echo off | | set info=互助互利,支付宝扫码头像,感谢赞助 | | rem 有问题,可加QQ956535081及时沟通 | | title %info% | | set "rootpath=%~dp0" | | if "%rootpath:~-1%" equ "\" (set "rootpath=%rootpath:~,-1%") | | cd /d "%rootpath%" | | set "zipexe=C:\Program Files\7-Zip\7za.exe" | | if not exist "%zipexe%" (echo;"%zipexe%" not found&goto end) | | for /f "delims=" %%a in ('dir /a-d/b *.epub') do ( | | echo;解压"%%a" | | md ".\%%~na\" 2>nul | | "%zipexe%" x -tzip ".\%%a" -o".\%%~na\" | | ) | | powershell -NoProfile -ExecutionPolicy bypass "Invoke-Command -ScriptBlock ([ScriptBlock]::Create([IO.File]::ReadAllText('%~f0',[Text.Encoding]::Default))) -Args '%rootpath%'" | | set "fd= | | if exist ".\%fd%\" rd /s /q ".\%fd%\" | | for /f "delims=" %%a in ('dir /ad/b') do ( | | if not exist ".\%fd%\" md ".\%fd%\" | | echo;打包"%%~nxa" | | "%zipexe%" a -tzip ".\%fd%\%%~nxa.zip" ".\%%~nxa\*" | | ren ".\%fd%\%%~nxa.zip" "%%~nxa.epub" | | rem rd /s /q ".\%%~nxa\" | | echo;--------------------- | | ) | | :end | | echo;%info% | | pause | | exit | | #> | | | | $deltxt='删除.txt'; | | $text=[IO.File]::ReadAllText($deltxt, [Text.Encoding]::UTF8); | | $tmp=$text -split '\r?\n-{8,}\r\n'; | | $Utf8NoBom=New-Object System.Text.UTF8Encoding $False; | | $folders=@(dir -liter $args[0]|?{$_ -is [System.IO.DirectoryInfo]}); | | for($i=0;$i -lt $folders.count;$i++){ | | $files=@(dir -liter $folders[$i].FullName -r|?{(@('.xhtml','.html') -contains $_.Extension) -and ($_ -is [System.IO.FileInfo])}); | | for($j=0;$j -lt $files.count;$j++){ | | write-host $files[$j].FullName.replace($args[0],''); | | $text=[IO.File]::ReadAllText($files[$j].FullName, $Utf8NoBom); | | for($k=0;$k -lt $tmp.count;$k++){ | | $text=$text.replace($tmp[$k],''); | | }; | | [IO.File]::WriteAllText($files[$j].FullName, $text, $Utf8NoBom); | | }; | | };COPY |
|