Script to rename files - Windows NT

This is a discussion on Script to rename files - Windows NT ; Is it possile to create a Windows commandline script in Win2K or Win XP that would rename files with name like ddmmyyyy.txt to yyyymmdd.txt? dd means day with two number mm means month with two number yyyy means yesr with ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Script to rename files

  1. Script to rename files

    Is it possile to create a Windows commandline script in Win2K or Win XP
    that would rename files with name like ddmmyyyy.txt to yyyymmdd.txt?

    dd means day with two number
    mm means month with two number
    yyyy means yesr with with 4 numbers

    Can Explorer do things like this?

    Or can this kind of task done only with external script language
    or a tool program?

    Any ideas?

    Thanks,

    jv

  2. Re: Script to rename files


    "Janne V" wrote in message
    news:357o13F4jhe31U2@individual.net...
    > Is it possile to create a Windows commandline script in Win2K or Win XP
    > that would rename files with name like ddmmyyyy.txt to yyyymmdd.txt?
    >
    > dd means day with two number
    > mm means month with two number
    > yyyy means yesr with with 4 numbers
    >
    > Can Explorer do things like this?
    >
    > Or can this kind of task done only with external script language
    > or a tool program?
    >
    > Any ideas?
    >
    > Thanks,
    >
    > jv


    Try this batch file:

    @echo off
    for %%a in (????????.txt) do call :sub %%a
    goto :eof

    :Sub
    set current=%1
    set d=%current:~0,2%
    set m=%current:~2,2%
    set y=%current:~4,4%
    set new=%y%%m%%d%.txt
    echo ren %current%.txt %new%.txt

    Remove the "echo" word when you're happy with the result.



  3. Re: Script to rename files

    Pegasus (MVP) wrote:
    > "Janne V" wrote in message
    > news:357o13F4jhe31U2@individual.net...
    >
    >>Is it possile to create a Windows commandline script in Win2K or Win XP
    >>that would rename files with name like ddmmyyyy.txt to yyyymmdd.txt?
    >>
    >>dd means day with two number
    >>mm means month with two number
    >>yyyy means yesr with with 4 numbers
    >>
    >>Can Explorer do things like this?
    >>
    >>Or can this kind of task done only with external script language
    >>or a tool program?
    >>
    >>Any ideas?
    >>
    >>Thanks,
    >>
    >>jv

    >
    >
    > Try this batch file:
    >
    > @echo off
    > for %%a in (????????.txt) do call :sub %%a
    > goto :eof
    >
    > :Sub
    > set current=%1
    > set d=%current:~0,2%
    > set m=%current:~2,2%
    > set y=%current:~4,4%
    > set new=%y%%m%%d%.txt
    > echo ren %current%.txt %new%.txt
    >
    > Remove the "echo" word when you're happy with the result.
    >
    >


    Thanks a lot!!!

    jv

+ Reply to Thread