PDA

View Full Version : Help with moving files with a .command file




MikePancho
Jul 21, 2013, 08:50 PM
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:o



chown33
Jul 21, 2013, 09:00 PM
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.

MikePancho
Jul 22, 2013, 09:54 AM
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 (http://pastebin.com/AZSQvZze)
Download (http://www.mediafire.com/download/13sh5hsaoa22swa/Install.command)

LPZ
Jul 22, 2013, 10:12 AM
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 (http://pastebin.com/AZSQvZze)
Download (http://www.mediafire.com/download/13sh5hsaoa22swa/Install.command)

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?)

wrldwzrd89
Jul 22, 2013, 11:16 AM
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?)
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.

LPZ
Jul 22, 2013, 11:38 AM
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.

I know this!

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

But you've taught someone something!