Forum Moderators: coopster
cat text.txt > new_tex.txt
can be used in PHP.
I tried
system (" cat text.txt > new_text.txt");
but it didn't work, the file new_text.txt was left blank.
Am I doing something wrong with the >?
Must I use something else instead of 'system'?
What do you mean with "the file new_text.txt was left blank" -- the file has been created, and nothing is in it?
Several things to check:
-- is there something in the webserver's error_log about this?
-- is your PHP script authorized to call external commands? (safe_mode...-settings in the config)
-- are you looking at the right place? Try to specify a /full/path/to/your/files, both to read and to write.
-- does the webserver find the cat command? State /bin/cat (or whatever) instead.
-- is the web server allowed to read and write within the directory the files are in? (directory and file permissions)
Regards,
R.