stripping multiple extensions off filename

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Thu Apr 24, 2003 8:48 pm

code for lammers.
here is algoritm

read a file name
brake it is to parts
count all part
make a new file name
rename function

New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK

Fri Apr 25, 2003 12:37 am

$renamed_file = (substr($file,-7) == '.tar.gz') ? rename($file,substr($file,0,-7).'.tgz') : NULL;

check the numerics on that though.
avatar image based upon nasas apod (only updates if I post though)

Post Reply