Jim
tcsh: Invalid null command
Ah, you're using
tcsh. Bad news! I'm sure it
could be made to work, but I've switched to
bash because it is better for this sort of stuff. Gary will tell you to switch to
zsh, but for now
bash will do. I just tried the command as posted and
tcsh complained loudly!
First point: often when you try to copy/paste from a browser window, you get an extra space appended to the line. It often doesn't matter, but it could here (may explain the "tcsh: Invalid null command" message). So copy the commands into a TextEdit document, which you have changed to Plain Text from the Format menu. Then be sure
not to include any trailing space.
Second point, we'll scrap the use of
sudo since it is only your Home directory that you are interested in.
Third point: as I said, we'll use
bash. The prompt will change to a '$' instead of a '%'. When you've finished, you can return to
tcsh with a plain
exit command.
So,
copy and paste the following into the Terminal window,
one line at a time, with a return after each line:
<pre>
bash
find -d ~/Documents \( -name "?" -o -name ":" \) -exec echo 'mv "{}" `echo "{}" |
sed -e "s^\?^_^g" -e "s^:^-^g" ` ' \; | sh
</pre>This should work—it did for me!
Note:
it returned a > prompt with nothing else on the line.
It will do this after the second line above—it is an invitation to complete the command 🙂