android - 批量重命名 - Android Bootanimation - 将文件重命名为 1 到 100 之间的不同步骤

标签 android batch-file file-io batch-rename boot-animation

我有 100 个连续的 PNG 文件,用于一个开机动画。但是它们之间的步骤不同

Example: 1, 4, 5, 10, 14, 15, 16, 19...

使用 Ant Renamer就足够了,它是一个很好的应用程序,但我喜欢用带有批处理文件的旧黑屏来完成。

谁能给我一个想法,如何将它们从 1 重命名为 100 并保留序列的顺序?

最佳答案

保存为批处理文件并以文件夹路径作为参数调用。默认处理当前文件夹

@echo off
    setlocal enableextensions disabledelayedexpansion

    rem - Set folder to be processed
    set "folder=%~1"
    if not defined folder set "folder=%cd%"

    rem - Prepare work environment
    pushd "%folder%" & setlocal enabledelayedexpansion

    rem - Load file list into array with number padding
    for /f %%a in ('dir /b /a-d "*.png"^|findstr /i /r /x /c:"[0-9]*\.png"') do (
        set /a "n=100000000+%%~na"
        set "n[!n!]=%%a"
    )

    rem - Retrieve the list from memory and, for each element in the
    rem   array, rename the file to the correct name
    set "n=1"
    for /f "tokens=2 delims==" %%a in ('set n[') do (
        set "name=000!n!"
        echo ren "%%a" "!name:~-3!.png"
        set /a "n+=1"
    )

    rem - Cleanup
    endlocal & popd 
    endlocal

关于android - 批量重命名 - Android Bootanimation - 将文件重命名为 1 到 100 之间的不同步骤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25822249/

相关文章:

java - Android 应用程序在计时器循环时崩溃

java - 如何处理 Observer 中的数据输出?

java - 为什么android只能发送二进制数据到FTP服务器?

batch-file - 使用批处理文件创建一个文件夹和多个子文件夹

winapi - 有没有办法跟踪批处理文件的执行情况?

c++ - 使用 FILE_ATTRIBUTE_TEMPORARY 和 FILE_FLAG_DELETE_ON_CLOSE

android - Cordova添加平台android错误

batch-file - 批量打开设备和打印机窗口?

javascript - OS.File 在 OS.read 之前检查最后修改日期

时间:2018-03-08 标签:c++textfileborland