Ask questions via twitter! Message any question to @answers on twitter. We'll publish the question and send you a reply each time there's a new answer.
Next Question

Question

 
June 12, 2009 09:21 PM

In Linux, how can I add the .html suffix to fifty different files at once?

I have a bunch of files that I used wget to download from a wiki. The problem is that when they downloaded, they downloaded without a .html suffix. i.e. "After_Hours" instead of "After_Hours.html".

How can I add the .html suffix to all these files at once? I tried "rename * *.html" but it gave me "Bareword "After_Hours" not allowed while "strict subs" in use at (eval 1) line 1." and stopped.
Interesting Question?  Yes (0)   No (0)   
Email to a friend | RSS
 
 

 
   No Best Answer Selected
 
 


Answers (2)

Sort By
 
June 13, 2009 04:28 AM
Try this:
mv * *.html
that's - mv for the 'move' command, then a space, then * for everything, then another space, then *.html to add the .html extension.
Should work but make sure you have a backup of the files first, you never know...

Helpful Answer?  (0)   (0)    Tip dholowiski for this answer
Permalink | Report
   Reply  
 
 
 
June 13, 2009 07:13 AM - Fact Refuted
Doesn't work, gives a mv: target '``'*.html` is not a directory

Report
 
 
 
June 13, 2009 07:15 AM
use this command
for i in * ; do mv $i $i.html ; done
Source(s):
> 20 years of shell programming


Helpful Answer?  (0)   (0)    Tip wdawe for this answer
Permalink | Report
   Reply  
 
 
 
June 24, 2009 04:52 AM
The for command in the shell is a great one to learn even though it doesn't look pretty. Once you know it, it comes in handy for all sorts of little things like this.

Report
 
 

Answer this Question


Ask a Question


140 characters left
Top of Page
Buy Mahalo Dollars with Credit Card or PayPal

Top Members

This Week All Time
  • buddawiggi
    buddawiggi
    2nd Degree Black Belt
    27933 Points
    M$806.66 Earned
  • opher
    opher
    Purple Belt
    4757 Points
    M$203.72 Earned
  • annelisle
    annelisle
    Purple Belt
    3308 Points
    M$99.72 Earned
   See All
 

Most Popular Tags

mahalo(1635)
iphone(466)
music(464)
google(360)
food(325)
online(298)
beer(279)
money(264)
movies(262)
apple(253)
aotd(235)
health(220)
video(208)
free(206)
dog(205)
   See All
 

Categories

Welcome New Members


 
 
Mahalo Dollars are the currency of Mahalo Answers.

Each Mahalo Dollar costs $1.

Once you earn more than 40 Mahalo Dollars, you can request to be paid via PayPal. Each Mahalo Dollar is currently worth $0.75 when paid out via PayPal. Learn More

 
 

Please log in to use this function.