Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Renaming a file via terminal

  1. #1
    Join Date
    Jul 2010
    Location
    You'll never know.
    Beans
    39
    Distro
    Ubuntu 10.04 Lucid Lynx

    Smile Renaming a file via terminal

    Bit of a silly mistake here...

    I was on Inkscape, made a *.SVG and went to save it. Now, I went to overwrite a *.GIF file and I saved it as a *.GIF file. So now I have a SVG saved as a GIF in the folder with all my photography.

    I'm assuming the file is being read wrong and/or it can't generate a thumbnail. But I open it, go to rename it and then it freezes. Sometimes the whole pc freezes, but not always.

    Any help would be appreciated, John.

  2. #2
    Join Date
    Jan 2008
    Location
    Manchester UK
    Beans
    13,573
    Distro
    Ubuntu

    Re: Renaming a file via terminal

    You rename a file
    Code:
    mv file.ext new_name.ext
    Don`t type mv *.GIF *.SVG or you will rename every GIF to a SVG

  3. #3
    Join Date
    Jul 2010
    Location
    You'll never know.
    Beans
    39
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Renaming a file via terminal

    Quote Originally Posted by nothingspecial View Post
    You rename a file
    Code:
    mv file.ext new_name.ext
    Don`t type mv *.GIF *.SVG or you will rename every GIF to a SVG
    Tried this. Came up with both:

    Code:
    john@john-desktop:~$ mv vilkija_COA.gif vilkija_COA.svg
    mv: cannot stat `vilkija_COA.gif': No such file or directory
    and
    Code:
    john@john-desktop:~$ mv vilkija COA.gif vilkija_COA.svg
    mv: target `vilkija_COA.svg' is not a directory

  4. #4
    Join Date
    Apr 2010
    Location
    England
    Beans
    3,286

    Re: Renaming a file via terminal

    You need to cd to the directory containing the images first, or else use the full path.

    e.g.
    Code:
    cd Pictures
    mv vilkija_COA.gif vilkija_COA.svg
    OR

    Code:
    mv /home/username/Pictures/vilkija_COA.gif /home/username/Pictures/vilkija_COA.svg
    (replace username with your username, obviously)

    Oh, and if the filename has a space in it, then use a backslash to escape the space. e.g.
    Code:
    mv vilkija\ COA.gif vilkija\ COA.svg
    http://xkcd.com/293/
    There are 10 kinds of people in this world: Those who understand ternary, those who don't, and those who confuse it with binary.

  5. #5
    Join Date
    Jan 2008
    Location
    Manchester UK
    Beans
    13,573
    Distro
    Ubuntu

    Re: Renaming a file via terminal

    Does the file have a space in it?

    If so you need to escape the space

    Code:
    mv vilkija\ COA.gif vilkija_COA.svg
    Do you already have a file
    vilkija_COA.svg
    mv will rename a file or directory unless the target directory exists in which case it will move it inti oi.

  6. #6
    Join Date
    Jul 2010
    Location
    You'll never know.
    Beans
    39
    Distro
    Ubuntu 10.04 Lucid Lynx

    Arrow Re: Renaming a file via terminal

    Quote Originally Posted by WorMzy View Post
    Code:
    cd Pictures
    mv vilkija_COA.gif vilkija_COA.svg
    Code:
    mv /home/username/Pictures/vilkija_COA.gif /home/username/Pictures/vilkija_COA.svg
    Code:
    mv vilkija\ COA.gif vilkija\ COA.svg
    Quote Originally Posted by nothingspecial View Post
    Code:
    mv vilkija\ COA.gif vilkija_COA.svg
    I tried all these and none worked. Though I said my photography, I din't mean my "Pictures" folder. I mean a folder called "Wiki Images" on my "Desktop". Probably why I ended up doing one of them wrong.

  7. #7
    Join Date
    Jan 2008
    Location
    Manchester UK
    Beans
    13,573
    Distro
    Ubuntu

    Re: Renaming a file via terminal

    Code:
    cd ~/Desktop/Wiki
    or open a terminal and drop the Wiki folder into it. It won`t eat it, it will just take the terminal there.

  8. #8
    Join Date
    Apr 2009
    Location
    Midwest, U.S.A.
    Beans
    1,209
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Renaming a file via terminal

    You can 'rename' a .svg file to a .gif ... but the file is still a .svg file.
    Code:
    file vilkija_COA.gif
    Laptop: Dell Inspiron 8200 - Fedora 13 - Goddard
    Desktop: Self-Built - [Ku, Lu, Xu, U]buntu - Lucid 10.04.3 (LTS)
    Linux User: 498249 / Ubuntu User: 29241

  9. #9
    Join Date
    Jul 2010
    Location
    You'll never know.
    Beans
    39
    Distro
    Ubuntu 10.04 Lucid Lynx

    Arrow Re: Renaming a file via terminal

    Quote Originally Posted by nothingspecial View Post
    Code:
    cd ~/Desktop/Wiki
    or open a terminal and drop the Wiki folder into it. It won`t eat it, it will just take the terminal there.
    Quote Originally Posted by AlphaLexman View Post
    You can 'rename' a .svg file to a .gif ... but the file is still a .svg file.
    Code:
    file vilkija_COA.gif
    @nothingspecial I tried your code, and it didn't work (see output below)
    Also, I can't drag the folder as my Desktop has literally just froze. It's becoming more unstable by the second.

    @AlphaLexman And yet it's killing my PC... :/

    Code:
    john@john-desktop:~$ cd ~/Desktop/Wiki Images
    bash: cd: /home/john/Desktop/Wiki: No such file or directory

  10. #10
    Join Date
    Apr 2009
    Location
    Midwest, U.S.A.
    Beans
    1,209
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Renaming a file via terminal

    If a directory has a 'space' in it, you will need to put a backslash \ in front of the space.
    john@john-desktop:~$ cd ~/Desktop/Wiki Images
    should be:
    Code:
    john@john-desktop:~$ cd ~/Desktop/Wiki\ Images
    Laptop: Dell Inspiron 8200 - Fedora 13 - Goddard
    Desktop: Self-Built - [Ku, Lu, Xu, U]buntu - Lucid 10.04.3 (LTS)
    Linux User: 498249 / Ubuntu User: 29241

Page 1 of 2 12 LastLast

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
  •