Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Posts
    2

    Question Unanswered: Rename Files in Directory

    Hi
    I need help with a Rename script to perform the following. Any help will be greatly appreciated.

    I have a dir. of files named
    exmpl.24.jpg
    exmpl.27.jpg
    exmpl.28.jpg
    exmpl.30.jpg
    exmpl.44.jpg

    I also have a list containg
    24
    28
    44

    If the file name contains a number from the list, I want to rename the file.
    new.24.jpg
    new.28.jpg
    new.44.jpg


    Thanks

  2. #2
    Join Date
    Nov 2002
    Posts
    207
    I would do the following...

    for loop for (24, 28, 44)
    ...
    if file exists (exmpl.$_.jpg)
    rename function

    ...

  3. #3
    Join Date
    Apr 2004
    Posts
    2
    Thanks for the reply, although I dont quite understand it.
    I found another way to do task that worked out great.

    cat list | xargs -i mv exmpl.'{}'.jpg new.'{}'.jpg

    Thanks Rick

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •