How do I accomplish renaming bulky indexed files to smaller number?


  1. Posts : 55
    windows 10
       #1

    How do I accomplish renaming bulky indexed files to smaller number?


    How do I accomplish renaming bulky indexed files to its smaller index number, with any kind of tools ?
    That is to rename

    1.c -> 0.c
    2.c -> 1.c
    ...
    7.c -> 6.c
    8.c -> 7.c
    9.c -> 8.c
    ...
    ...
    (in large numbers of files.) Thank so much in advance
      My Computer


  2. Posts : 15,497
    Windows10
       #2

    budi said:
    How do I accomplish renaming bulky indexed files to its smaller index number, with any kind of tools ?
    That is to rename

    1.c -> 0.c
    2.c -> 1.c
    ...
    7.c -> 6.c
    8.c -> 7.c
    9.c -> 8.c
    ...
    ...
    (in large numbers of files.) Thank so much in advance
    You could create a batchfile e.g. rennum.bat

    Using following from admin command prompt



    Dir /b /s > dir.txt

    Then create a batch file rennum.bat with

    rename

    Repeated many times.

    Then use notepad++ which supports block column copy to paste all of contents of dir.txt after the rename commands. Then paste same data shifted up one line after the first block.

    Microsoft OneDrive - Access files anywhere. Create docs with free Office Online.
    Last edited by cereberus; 02 Dec 2017 at 07:14.
      My Computer


  3. Posts : 55
    windows 10
    Thread Starter
       #3

    I'd solve and answer mine. on Windows cmd.exe console:

    cmd /v /k
    for /f %x in ('dir /b ??.c') do (set/a t=%~nx-1 &ren %x !t!.c)



    rename to greater number; dir in reversed and +1, i.e. use:


    dir /b /o-n
    t =%~nx-1


    Much better is to get TCC/LE more improved and sensible cmd.exe duplicate
      My Computer


  4. Posts : 55
    windows 10
    Thread Starter
       #4

    I'd solve and answer mine. on Windows cmd.exe console:


    cmd /v /k
    for /f %x in ('dir /b ??.c') do (set/a t=%~nx-1 &ren %x !t!.c)


    rename to greater number; dir in reversed and +1, i.e. use:


    dir /b /o-n
    t =%~nx+1


    Much better is to get TCC/LE more improved and sensible cmd.exe duplicate
      My Computer


  5. Posts : 809
    Win10
       #5

    You can also do this in PowerShell:

    Code:
    foreach ($file in Get-ChildItem -Filter *.c -Recurse) {
      if ($file.fullname -match '\\([0-9]+?)\.c') {
        Rename-Item $file.fullname ([string]($matches[1]-1)+'.c')
      }
    }
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 09:56.
Find Us




Windows 10 Forums