Results 1 to 3 of 3

Thread: renaming folders with terminal

  1. #1
    Join Date
    Jul 2010
    Location
    England
    Beans
    202
    Distro
    Ubuntu

    renaming folders with terminal

    Hi All,

    I have been doing more and more via the terminal but come across this and it really bugs me.

    If I create a folder with a space in it within terminal (some_folder_name) i always use the underscore but if i create just a new folder using the gui it will use (new file (2nd copy) not new_file_(2nd_copy)

    if that makes sense.

    ok so if i use mv in terminal how would i change "new file (2nd copy)" to "new_file_(2nd_copy).

    terminal keeps complaining about the unexpected token `)'

    i thought just cd to directory and use the "\" where a space is or am i being a bit thick and missing a vital part.

    I do keep telling my family to stop using spaces but i am doing my best to keep them away from the ms mindset...
    Cheers,

    Spill.
    amd 2.8Ghz quad core
    GeForce 8600 GT
    4Gb ram
    10.04

  2. #2
    Join Date
    May 2006
    Location
    Milwaukee,WI
    Beans
    5,926
    Distro
    Xubuntu 12.04 Precise Pangolin

    Re: renaming folders with terminal

    so your folder or filename actually has a parenthesis in it?
    i think it would this
    mv 'new file (2nd copy)' 'new_file_(2nd_copy)'
    using a single quote around the filename BUT I would strongly suggest NOT using special characters in filenames!! Spaces aren't half as bad as special characters like parenthesis!
    Check out my Blog about my life and computer software and hardware. http://ubuntuaddicted.blogspot.com/
    My YouTube channel:
    http://www.youtube.com/ubuntuaddicted

  3. #3
    Join Date
    Sep 2006
    Beans
    7,022
    Distro
    Lubuntu Development Release

    escapes

    Try with single quotes or escaping the parenthesis and spaces with backslashes

    Code:
    mv 'new file (2nd copy)' 'new_file_(2nd_copy)'
    # Or
    mv new\ file\ \(2nd\ copy\) new_file_\(2nd_copy\)

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
  •