469,306 Members | 1,901 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

How to write to a ".txt" file present on remote machine?

shrek123
How to write to a ".txt" file present on remote machine.

I dont want to use two way socket connection. Is there any other way to write to a file on remote machine?

Best Regards,
Shrek.
Sep 3 '07 #1
9 3496
Hey I got the way........
Here is the code:

Expand|Select|Wrap|Line Numbers
  1. $remote= '\\\remotehost\remotedir\remotefile.txt';
  2. open(fp, ">$remote") or die ("could not open the file");
  3.  
  4. print fp "PAUSE";
  5.  
  6. close(fp);
  7.  
  8.  
Sep 3 '07 #2
numberwhun
3,503 Expert Mod 2GB
Nicely done. Thanks for letting us know.

Regards,

Jeff
Sep 3 '07 #3
KevinADC
4,059 Expert 2GB
I'm surprised that works.
Sep 3 '07 #4
numberwhun
3,503 Expert Mod 2GB
If it does, so be it. At least they found something that works for them. :-)

Jeff
Sep 3 '07 #5
I'm surprised that works.
Hey KevinADC,

its working for me.....
Can you please let me know, does the above code hamper the performance of the complete script??
Sep 4 '07 #6
KevinADC
4,059 Expert 2GB
As far as I know there is no efficiency or performance issue with the code you posted. I was just surprised it worked. Writing to files on remote machines is generally not done using the open() function. There must be something else that is allowing your perl script to access the remote machine/file and write to it. Or maybe I am just totally confused.
Sep 4 '07 #7
numberwhun
3,503 Expert Mod 2GB
I would think that, even in the Windows environment, he would have to have the drive mapped and have access. If he does, it seems logical to be able to access a mapped drive. That is what it looks like he is doing.

Regards,

Jeff
Sep 4 '07 #8
KevinADC
4,059 Expert 2GB
I think you're right.
Sep 4 '07 #9
Kelicula
176 Expert 100+
Must be, I tried it from my PC to my host, and it was
access denied baby. But it did try, and it worked in that much.
Sep 5 '07 #10

Post your reply

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

Similar topics

6 posts views Thread by bettina | last post: by
8 posts views Thread by Juan Manuel Alegrķa B. | last post: by
5 posts views Thread by shantanu | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.