UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old November 11th, 2004, 09:17 AM
Redmiata Redmiata is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: Eastern NC
Posts: 2 Redmiata User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 48 sec
Reputation Power: 0
Help renaming files

I have a series of log files with names like 'Nov9-21:30' on a Sun machine that I need to FTP to my Windows machine. Windows can't deal with the : in the file name so I would like to rename all the files to change the :'s to -'s . How do I change the one character in all the filenames?

Thanks

Reply With Quote
  #2  
Old November 11th, 2004, 12:09 PM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,083 guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 19 h 49 m 57 sec
Reputation Power: 9
to be save, go to sun in that dir, make a sub dir (say aaa)
for file in `ls *:*`
do FILE=`echo $file | sed 's/:/-/g'`
cp $file aaa/$FILE
done
the cp will preserve your original files, making a copy in aaa
so: abc:123 will result in aaa/abc-123
then go to that-dir/subdir and using ftp: 'mget *'

Reply With Quote
  #3  
Old November 11th, 2004, 12:31 PM
Redmiata Redmiata is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: Eastern NC
Posts: 2 Redmiata User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 48 sec
Reputation Power: 0
Thanks

Perfect. Worked like a charm.
Thank you.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Help renaming files


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway