bash - rename files in a loop

Discussion in 'Programming/Scripts' started by turki_00, Mar 31, 2011.

  1. turki_00

    turki_00 New Member

    Hi,
    I need to rename the resulted searched files from a loop

    I have the following code:

    find . -name DOC* | while read i
    do
    find $i -type f -name '*.txt'
    done

    basically, I am searching for all txt files inside any folder starting with DOC name.
    this code is working fine with me.
    I need to rename those .txt files to .txtOLD

    OS: Ubuntu 10.4
    Bash shell

    how can i do that , appreciate your help
    Thank you,
     
  2. alleks

    alleks Member

    that's easier than it looks

    just do a
    Code:
    mv *.txt *.txtOLD
    :)
     

Share This Page