Blog

 

How to get a file extension in PHP, PERL...

 

How to get a file extension in PHP:
 

$ext = pathinfo($file_name, PATHINFO_EXTENSION);

How to get a file extension in Perl:
 

my $ext = ($file_name =~ m/[^.]+$/)[0];

How to get a file extension in Ruby:
 

ext = File.extname(file_name) 

How to get a file extension in Bash:
 

ext=${file_name#*.}
name=${file_name%.*}

How to get a file extension in Python (thanks to Jensen):
 

import os
ext = os.path.splitext(file_name)[1]

 


AUTORIZED RETAILER
timkom autorized retails
2co
2Checkout is the authorized retailer of goods and services provided by Timkom
AUTORIZED RESELLER
Download software
usergate and firewall
BUY A BOOK
AbeBooks Generic Banner 180x150