Hello:
I have a php file, when it is executed I would like it to append one file to another.
Can anyone tell me the command for this. I think it might be possible to use the system
command and cat temp.txt >> file.txt but I can't seem to get the statement correct.
Can anyone help me out?
temp.txt file needs to be appended to file.txt and I want to do this inside my PHP code.
thanks,
Jason
PHP Append One File To Another
Moderator: General Moderators
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
I tried something like
but it did not work. the files will change on a daily basis. the system command would work
if the files were static.
since the files change daily, that is why i am looking for a system solution or something, but
i think the system command will only accept two " " which prevents me from using $temp or
something like that.
thanks for the help.
Code: Select all
system("cat $temp >> $main");if the files were static.
Code: Select all
system("cat temp.txt >> main.txt");i think the system command will only accept two " " which prevents me from using $temp or
something like that.
thanks for the help.
I just did it another way.
i just thought there might be a one line with system() instead of a few.
thanks guys..
Code: Select all
fputs($fp, "cat ".$temp." >> ".$main);
and
system(". batch.bat &");thanks guys..