返回列表 发帖
本帖最后由 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
1

评分人数

    • lxh623: 谢谢!请查收!技术 + 1
提供bat代写,为你省时省力省事,支付宝扫码头像支付
微信: unique2random

TOP

本帖最后由 zaqmlp 于 2019-8-29 21:01 编辑

回复 9# lxh623

删除.txt里的内容是按里面xhtml的原文内容添加,原文没空格,所以就没空格
已修改,改用7z解包打包
提供bat代写,为你省时省力省事,支付宝扫码头像支付
微信: unique2random

TOP

返回列表