Skip to Content

rename file with prefix in sap bods

Hi Experts,

I have fail name "Murali06062017" . I need to rename file like "Ready_Murali06062017" in bods using rename DOS commands.

I have multiple files in a path.
1. Murali06062017
2. Krishna06062017 in D:\Temp folder

I need to rename files in same path D:\Temp Folder
1. Ready_Murali06062017
2. Ready_Krishna06062017

For this I tried this way. But it was not worked

exe('cmd','rename D:\Temp\*.txt Ready_*.txt')

Please get me help on this. I google it but could not able to find proper solution.

Thanks and Regards,

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Jun 13, 2017 at 01:40 PM


    I have something similar developed. I hope it be usefull, and sorry for my English.

    Let me Know if it helps you.!!!!!!!!!!!!!!!!!!

    I used a .bat and then I execute from BODS. Like this:

    The bat move and rename a file depend on the variables send it trhough BODS. I control the rename if the file was success or failed, so I sent the prefix.

    and then in BODS, Look like:

    A variable has the control, if variable = 0 that error. I move the file to a carpet called Error.

    If variable <> 0 that success. I move the file to a carpet called Exito (success). Both case I rename the name of the file.

    I leave the code

    @echo off
    rem echo Probando
    rem set ruta1=E:\CargasDs\
    rem set ruta2=E:\CargasDs\Exito\
    rem set archivo=Libro1.xlsx
     set ruta1=%1
     set ruta2=%2
     set archivo=%3
     set renombre=%4
    rem move C:\carpeta1\DSConfig.txt C:\carpeta2
    rem move C:\carpeta1\DSConfig.txt %ruta2%
    echo %ruta1%%archivo% %ruta2%
    move %ruta1%%archivo% %ruta2%
    ren %ruta2%%archivo% %renombre%%archivo%
    rem pause
    Add comment
    10|10000 characters needed characters exceeded