Help with moving files with a .command file

Discussion in 'Mac Programming' started by MikePancho, Jul 21, 2013.

  1. macrumors newbie

    Joined:
    Dec 20, 2012
    #1
    I am having lots of trouble moving files to another folder with a .command file. I need to move:

    ~/Desktop/"AnimatedMC + HoeCraft"/"Resources"/"AnimatedMC + HoeCraft 1.5.2" to ~/Library/Application Support/minecraft/texturepacks

    ~/Desktop/AnimatedMC + HoeCraft/Resources/"AnimatedMC + HoeCraft 1.6.2" to ~/Library/Application Support/minecraft/recourcepacks

    ~/Desktop/AnimatedMC + HoeCraft/Resources/"en_US.lang" to ~/Library/Application Support/minecraft/bin/minecraft.jar

    How would I do that?

    Thank You,
    Mike:eek:
     
  2. macrumors 603

    Joined:
    Aug 9, 2009
    #2
    Post the .command file you tried that didn't work. Also post the exact error message.

    Spaces embedded in filenames must be quoted. Apply that rule to the destination filename of your first example.

    If something isn't working, we need to see the exact command-line, and the error message you got.
     
  3. thread starter macrumors newbie

    Joined:
    Dec 20, 2012
    #3
    There wasn't an error message, Terminal just opened then closed real fast and the files weren't moved. You can't attach a .command file so here is the code and download link:
    Code
    Download
     
  4. LPZ, Jul 22, 2013
    Last edited: Jul 22, 2013

    LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #4
    Perhaps you need to escape the spaces. Try using \ before each space character. And lose the quotation marks.

    Code:
    mv ~/Desktop/AnimatedMC\ +\ HoeCraft/Resources/AnimatedMC\ +\ HoeCraft\ 1.5.2   ~/Library/Application\ Support/minecraft/texturepacks
    (And why do you need to do this with Terminal?)
     
  5. macrumors G4

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
    #5
    The simple answer: Terminal expects the space character to be a command/argument separator.

    The long, complex answer: The problem isn't strictly Terminal.app's fault. It's caused by the command shell running inside of it (bash, tcsh, zsh, etc.) interpreting the spaces in your path as separators when this isn't intended. This causes the shell to think that "~/Desktop/AnimatedMC", "+", "HoeCraft/Resources/AnimatedMC", etc. are separate arguments to the mv command, which obviously causes it to fail with a file not found error.
     
  6. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #6
    I know this!

    I meant "OP, why are you moving the files with Terminal?"

    But you've taught someone something!
     

Share This Page