I downloaded a perl file from some webpage by opening it in my browser and saving it. But the saved file has a file name xxx.pl.txt. How can I save it into a file with pl as its ext?

Also how to change a file's ext?

Can I do these in command line?

Thanks and regards!

link|improve this question

57% accept rate
feedback

3 Answers

up vote 5 down vote accepted

From the command line:

rename xxx.pl.txt xxx.pl
link|improve this answer
More direct indeed. – Gnoupi Jun 8 '10 at 13:12
Beat me by a few seconds. Well done. – MDMarra Jun 8 '10 at 13:13
feedback

The extension is only a part of the file name. If you rename the file, you have only to take out the ".txt" extension, to have only pl.

I assume that you can see the full name, with extensions, according to what you said in the question. If not, you should change this option, following these instructions (for XP, but it's similar for Vista and 7).

link|improve this answer
I clicked at the file name, but the ext is not shown for me to change. It is only shown in it property. – Tim Jun 8 '10 at 13:10
@Tim you need to set the view to show extensions - Tools > Folder Options > View - uncheck "Hide extensions for known file types". This should be off by default as having it checked shows "virus.jpg.exe" as "virus.jpg". Having the former makes it less likely that you'll double click it. – ChrisF Jun 8 '10 at 13:13
Gnoupi: Keep in mind that the default is to not show file name extensions. Usually it's assumed that software does the right thing concerning file name extensions, so basically there would be little to no need for a normal user to ever mess with them (I only miss it once every second month or so as well). – Joey Jun 8 '10 at 13:13
@Johannes - I assumed that they were not hidden, because he described the full filename, with extension. I included instructions to show them, in case. – Gnoupi Jun 8 '10 at 13:15
@Joey: it is this braindead decision (by Microsoft) which made e-mail attachments with .doc.exe extensions to flourish... Beside, it is a useful information (the type column is verbose) and I change such extensions almost daily (with the idiotic warning "Are you sure you want to change this extension?". Yes, I am sure!) – PhiLho May 12 '11 at 11:20
feedback
rename originalname.ext newname.newext
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.