Using rename, and cp to rename a file.

Ray Parrish crp at cmc.net
Wed Feb 24 07:28:15 UTC 2010


James Michael Fultz wrote:
> * Ray Parrish <crp at cmc.net> [2010-02-23 20:11 -0800]:
>   
>> Hello,
>>
>> I get the following -
>>
>> ray at RaysComputer:~/logs/IIS$ rename /home/ray/logs/IIS/Grapg.html Graph.html
>> Bareword found where operator expected at (eval 1) line 1, near "/home/ray"
>>     (Missing operator before ray?)
>> syntax error at (eval 1) line 1, near "/home/ray"
>>     
> [...]
>   
>> ray at RaysComputer:~/logs/IIS$ c[ Grapg.html Graph.html
>>     
>
> rename on Ubuntu systems is a Perl utility that interprets Perl
> expressions.  See the man page for details.  A basic example would be as
> follows:
>
> $ rename s/g/h/ Grapg.html
>          ^      ^
>          |       \- File argument
>           \- Perl substitute expression
>
>   
>> Can someone please tell me what I am doing wrong here?
>>
>> Thank you, Ray Parrish
>>     
>
> For simple file or directory renames, the mv command is suitable.
>
> $ mv Grapg.html Graph.html
>
> A shorter form using brace expansion available in Bash or Zsh:
>
> $ mv Grap{g,h}.html
>   
I thank you both for answering me, and mv worked great to rename the file.

Thanks again, Ray Parrish

-- 
Linux dpkg Software Report script set..
http://www.rayslinks.com/LinuxdpkgSoftwareReport.html
Ray's Links, a variety of links to usefull things, and articles by Ray.
http://www.rayslinks.com
Writings of "The" Schizophrenic, what it's like to be a schizo, and other
things, including my poetry.
http://www.writingsoftheschizophrenic.com






More information about the ubuntu-users mailing list