Find the answer to your Linux question:
Results 1 to 5 of 5
I have a bunch of files named Invoice # xxxx.PDF that I would like to change to be Invoice xxxx.PDF. Does anyone know how to do that with a bash ...
  1. #1
    Just Joined!
    Join Date
    Jul 2007
    Posts
    2

    Batch File Rename

    I have a bunch of files named Invoice # xxxx.PDF that I would like to change to be Invoice xxxx.PDF. Does anyone know how to do that with a bash script? So far I have been thwarted in every attempt.

    Captainquack

  2. #2
    Linux Enthusiast
    Join Date
    Aug 2006
    Posts
    631
    Hi,

    Supposing you want to remove "# " from the filenames:

    Code:
    ls *.pdf|sed 's/\(.*\)# \(.*\)/mv "\1# \2" "\1\2"/' | sh
    Regards

  3. #3
    Linux User
    Join Date
    Jun 2007
    Posts
    318
    Franklin52,

    I'd tweek your example to look only for the files with the right filename syntax:

    Code:
    ls Invoice\ #\ ????.PDF |sed 's/\(.*\)# \(.*\)/mv "\1# \2" "\1\2"/' | sh

  4. #4
    Just Joined!
    Join Date
    Jul 2007
    Posts
    2
    Thank you very much.

  5. #5
    Just Joined!
    Join Date
    May 2008
    Posts
    1

    Thumbs up

    I use InnoRename to rename my huge picture files from my photo and my mp3 files too.
    Great program to try (find it there www.innoplanet.com).
    It can be programed and you can do a lot of combination easily.
    Try it.

Posting Permissions

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