473,386 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Unix file commands using PHP's system function

11
Hi all!
I am confused as to how an old-good UNIX command, like

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' ?
Nov 2 '05 #1
1 2556
pbmods
5,821 Expert 4TB
Heya, ktsirig.

Might be a permissions issue. Try this instead:
Expand|Select|Wrap|Line Numbers
  1. copy('text.txt', 'newtext.txt');
  2.  
Does the same thing, but without all the overhead of making a system() call. Plus, if anything goes wrong (such as 'permission denied'), PHP will throw a warning and let you know.
Dec 9 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: timdoyle05 | last post by:
Hi, I have a question relating to how Unix commands can be issued from Python programs. Im am currently writing a large test script in python and I need this script to call three other separate...
6
by: Joseph | last post by:
Hi, I am trying to develop a C# application that will run on Windows that will do the following * Select file name to process * FTP the file to a UNIX server * Process this file on UNIX using a...
4
by: Mark Harrison | last post by:
So, I'm recording the timestamp from some unix files. Any opinions as to whether it's best to use a "bigint" (which matches the file system data) or a "timestamp" (which might be easier to...
9
by: craig.overton | last post by:
All, I am currently developing an FTP class in VB.NET. It's kid tested, mother approved when trying to access an FTP Server on a Windows box meaning I can connect, run commands, upload and...
4
by: Michael | last post by:
Hi, I'm having difficulty finding any previous discussion on this -- I keep finding people either having problems calling os.exec(lepev), or with using python's exec statement. Neither of...
1
by: apsonline | last post by:
hi people i want to work on a project that would "emulate" unix commands like ls,rm etc... by making use of uunix system calls . by writing programs in c++ using system calls ,these programs...
0
by: Holly | last post by:
I copied this code that works to connect into Unix. I am looking for a way to get it to work with a secure Unix box. Anyone have any insights on how to do this? I am trying to build an sftp...
3
by: Vik Rubenfeld | last post by:
I'm developing a web site in PHP for an Apache server. I have a particular stand-alone application that takes a text file as input, and produces a text-file as output. It's usually run from the...
1
Nepomuk
by: Nepomuk | last post by:
In most modern distributions of Linux and Unix (at least ones with graphical environments like KDE, Gnome or XFCE), you get to mount your partitions easily from the desktop. In some cases however, it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.