Results 1 to 4 of 4

Thread: Rename all directories begining with "video - "

  1. #1
    Join Date
    Dec 2012
    Beans
    9

    Rename all directories begining with "video - "

    I have a directory with sub-directories. Some of the sub-directories I want to rename begin with "video - ". An example would be "video - Excel 2016 formulas". I would like to remove and rename the example to "Excel 2016 formulas". The 'v' in videos may or may not be upper case. I both instances, I want it removed.

    What I have so far is:

    Code:
    find . -type d -iname "video - *"
    I know I need a '-exec rm', but I don't know the specifics. Or should I be using 'rename'?

  2. #2
    Join Date
    Apr 2012
    Beans
    7,256

    Re: Rename all directories begining with "video - "

    You certainly do not need a '-exec rm' - that will remove (delete) the files

  3. #3
    Join Date
    Dec 2012
    Beans
    9

    Re: Rename all directories begining with "video - "

    So if I use a '-exec mv', then what?

    Would the proper way be:
    Code:
    for f in *; do mv '$f" "${f#video - }";done
    or

    Code:
    rename -v 'x/video - //' *
    Last edited by mainemojo; September 24th, 2018 at 07:38 PM.

  4. #4
    Join Date
    Dec 2013
    Beans
    8

    Re: Rename all directories begining with "video - "

    gprename is available for install thru package manager or in terminal sudo apt-get install gprename
    It should easily rename those folders from GUI
    Can be run from terminal gprename
    Takes a bit of getting used to, but not that hard at all from what I remember when I used it

    navigate to folder containing subfolders
    As eg... video - Excel 2016 formulas, including the spaces you need the first 8 characters removed
    Under insert/delete you can have it delete between 0 and 8....
    Then click Rename, not sure if Preview always works
    You may want to backup first just to be on safe side till you are use to the utility

    Edit-- sorry, just realized you said you have other folders that start with different names in that directory
    In that case the Replace/remove option might be better
    Replace video -
    with kept left blank then click on Preview, if everything looks good click Rename... It does have an undo feature
    Last edited by billrbilly; September 24th, 2018 at 11:41 PM.

Tags for this Thread

Bookmarks

Posting Permissions

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