rename file on Unix?
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix questions > rename file on Unix?




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    rename file on Unix?  
gogo


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-11-04 08:30 PM

I'd like to rename files with pattern *_new.* to files *_old.* and I
have diffuculties. The task is to rename these files in the whole
tree, not in one folder only.
I try someting like:
find ../folder *_new.* | do mv "{}" $(echo "{}"|sed s/_new/_old/g)
 ";"
but it does not work for me.


Any help will be appreciated.
Thansk
StAN





[ Post a follow-up to this message ]



    Re: rename file on Unix?  
William Park


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-11-04 10:36 PM

gogo <stanlitz@hotmail.com> wrote:
> I'd like to rename files with pattern *_new.* to files *_old.* and I
> have diffuculties. The task is to rename these files in the whole
> tree, not in one folder only.
> I try someting like:
> find ../folder *_new.* | do mv "{}" $(echo "{}"|sed s/_new/_old/
g) ";"
> but it does not work for me.

Try something like
find . -type f -name '*_new.*' | while read i; do
mv $i ${i/_new/_old}
done

--
William Park, Open Geometry Consulting, <opengeometry@yahoo.ca>
Linux solution/training/migration, Thin-client





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 12:37 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register