lundi 25 juillet 2016

Php script to replace specific string in filenames from database

I need a simple php script which needs to find files on server after reading Number column from database, copy files to another directory and then replace specific strings in saved files. For example we have files

20160107-151620_03216488727-all.mp3
20160418-105509_03225545395-all.mp3

We need to replace (03216488727, 03225545395) with the strings from database. Here is my database info:


Number                 Policy Number         Month
03216488727       123456788              2016-06
03225545395       123433339              2016-06

so after the replacement files will be

20160107-151620_123456788-all.mp3
20160418-105509_123433339-all.mp3

Please help.

Aucun commentaire:

Enregistrer un commentaire