stripping multiple extensions off filename

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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

Post by Oleg Butuzov » 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

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

Post by pootergeist » 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.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 3 guests