Results 1 to 4 of 4

Thread: 'mv' command didn't perform like I expected...

  1. #1
    Join Date
    Nov 2009
    Location
    Utah, USA
    Beans
    217

    'mv' command didn't perform like I expected...

    I just wanted to 'mv' a rom into a '.roms' folder in my home directory. I didn't have a '.roms' folder before I started. I was under the impression that once I:

    Code:
    mv zeldahackedrom.smc /home/riley/.roms
    then it would create the '.roms' folder for me and stuff zeldahackedrom.smc into it.

    However, even though 'ls -a' showed me that it was indeed in the home folder, if I tried 'cd .roms' it told me 'bash: cd: .roms: Not a directory'. Also, I couldn't see it in nautilus, but I did see all the other hidden files.

    So, I tried creating the directory (mkdir .roms) and it said "sorry, that's already a directory". So I removed it, did the 'mkdir .roms' thing, then moved the .smc into it and it works now.

    Any reasons why it wouldn't have worked the first time around? Has anyone had the same problem happen to them when trying to move files into a non previously existing folder?

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

    Re: 'mv' command didn't perform like I expected...

    Your command will move and rename the file if the .roms folder doesn't exist.

    Code:
    man mv
    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.

  3. #3
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,790
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: 'mv' command didn't perform like I expected...

    When the destination (2nd argument) is not a directory, mv works as 'move and rename'.

    In your case, your file was not only moved to /home/riley/, but also renamed to .rom

    BTW, you can see hidden folder and files (start with a dot) on Nautilus, by pressing Ctrl+H.

    Hope it helps.
    Regards

  4. #4
    Join Date
    Nov 2009
    Location
    Utah, USA
    Beans
    217

    Re: 'mv' command didn't perform like I expected...

    Aaaaah, duh. It shoulda been:
    Code:
    mv thefile.smc /home/riley/.roms/thefile.smc
    Thanks guys

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
  •