Hi,
I’m using file_get_contents to read a file and inset the contents line by line into a db. Then i want to rename the file afterwards. I wondered what would be the recommended (or safest!) way to rename the file that i just processed?
thanks,
Hi,
I’m using file_get_contents to read a file and inset the contents line by line into a db. Then i want to rename the file afterwards. I wondered what would be the recommended (or safest!) way to rename the file that i just processed?
thanks,
Well, just use the rename function, that is what it’s there for.
$dirname=“somefilename…”;
$newname=“newfilename.txt”;
rename($dirname , $newname);
You could COPY it to another folder for a backup and then rename it there.
It depends on what you want to keep the file for and how many you keep.
Good luck!