Help with moving files with a .command file

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

  1. MikePancho macrumors newbie

    Dec 20, 2012
    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,
  2. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    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. MikePancho thread starter macrumors newbie

    Dec 20, 2012
    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:
  4. LPZ, Jul 22, 2013
    Last edited: Jul 22, 2013

    LPZ macrumors 65816

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

    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. wrldwzrd89 macrumors G5


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

    The long, complex answer: The problem isn't strictly'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

    Jul 11, 2006
    I know this!

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

    But you've taught someone something!

Share This Page