473,414 Members | 1,751 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,414 software developers and data experts.

How to sent file ?!

viktorijakup
Hello !!!

My directory D:\conv\ESSD\YJCIS\YJCIS14183\bbb.doc

I must send to X:\sgml_db\ESSD\YJCIS\YJCIS14183\
directory and rename bbb.doc to MMC1.doc.
If X:\sgml_db\...\....\YJCIS14183\ don't exist, i must create it.

"X:\sgml_db\" constant directory.

My script must choose path itself !
What I must add to this script !!!
Expand|Select|Wrap|Line Numbers
  1. use strict;
  2. use warnings;
  3. use File::Copy;
  4. use File::Path;
  5.  
  6. my $sDest = 'X:/whatever';
  7. mkpath $sDest;
  8. copy('D:/whatever/bbb.doc', qq{$sDest/MMC1.doc});
  9.  
Sep 3 '08 #1
3 1217
numberwhun
3,509 Expert Mod 2GB
So, what exactly is happening when you run this? Is it doing anything that you expect? You were quite vague in the description of your issue, but I will do my best here.

Here are a couple of suggestions:

1. For the mkpath line, use the following:

Expand|Select|Wrap|Line Numbers
  1. mkpath ( $sDest, {verbose => 1} );
  2.  
This will print out to the screen telling you it created the directory. If it doesn't , then you have a problem.

2. I would modify your copy statement to be the following:

Expand|Select|Wrap|Line Numbers
  1. copy('D:/whatever/bbb.doc', qq{$sDest/MMC1.doc}) or die "Could not copy:  $!";
  2.  
That will output the error, if there is one, given during the copy step.

3. Please use code tags around any code you place in the forums. As you can see, I have done so for each example here and also corrected your original posting.

Regards,

Jeff
Sep 3 '08 #2
KevinADC
4,059 Expert 2GB
He has this question posted on several perl forums.
Sep 3 '08 #3
Hello !!!

Thank you for correction of my script. This script runs perfectly,
but in this script i must direct path. I would like run script in all
directoties and don't rewrite path in script every time.

I have a lof of files in different directories:
Examples:
D:\conv\ESSD\YJCIS\YJCIS14136\TOC.doc;
D:\conv\ESNL\APNUM\APNUM2185\vvvv.pdf;
D:\conv\ESME\BULSCI\BULSCI2303\rrr.tex...
.........and so on....
Constant path is "D:\conv", doesn't change
%%%%
For example:
I must send from
D:\conv\ESSD\YJCIS\YJCIS14136\

selective "TOC.doc" file to

X:\sgml_db\ESSD\YJCIS\YJCIS14136\

Constant path is "X:\sgml_db", doesn't change, the same "\ESSD\YJCIS\YJCIS14136\" catalogue name.

and rename "TOC.doc" to "MMC1.doc";
if i have "vvvv.pdf" I rename "MMC1.pdf" and so on.....

My script must undestand "paths", I want sent file from
directory to the same directory, only change "D:\conv\" to "X:\sgml_db\" path.

What i must add to this script !!???
Expand|Select|Wrap|Line Numbers
  1. use strict;
  2. use warnings;
  3. use File::Copy;
  4. use File::Path;
  5.  
  6. my $sDest = 'X:/sgml_db/ESSD/YJCIS/YJCIS14136/';
  7. mkpath ($sDest, {verbose =>1});
  8. copy('D:/conv/ESSD/YJCIS/YJCIS14136/bbb.doc', qq{$sDest/MMC1.doc}) or die "Could not copy: $!";
  9.  
Thank you !

Viki
Sep 4 '08 #4

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

Similar topics

2
by: Dariusz | last post by:
I have a problem where when I run the PHP code offline, there are no errors produced and the code runs as expected. However when I uploaded the same script and run it, it says the headers have...
1
by: a c s | last post by:
Hi there, my problem is as follows: When emailing a file using PHP 4.0.6, the attachment received is an empty "attachment.txt" file instead of the actual file I attached. Any suggestions why...
4
by: Q | last post by:
Hello, I have composed the following simple php file: <html> <head><title> Title. </title></head> <body> <?php header("Location: http://www.something.com/tmp2.php"); ?> </body>
4
by: zelzel.zsu | last post by:
I wrote two simple socket program. one for sending a file and the other for receiving the file. but when I run it, a curious thing happened. The received file was samller that the sent file. $...
3
by: Lars Netzel | last post by:
Hi I send a PDF to the client. It's a file with dynamic content but the same filename and in an old Explorer 5 client it always pull the saem file even though it should be a new file sent to...
1
by: Piotrekk | last post by:
Hi I have a question. Why file, that i wanna send is sent only partially. When i wanna send 4xx kb only 266 is sent. Thanks for your help PK Here is the code: if (Client.Connected)
1
by: William Connery | last post by:
Hi, I have a small python program with e-mail capabilities that I have pieced together from code snippets found on the internet. The program uses the smtplib module to successfully send an...
9
by: John C. Frickson | last post by:
My company produces reports for our customers in PDF format. I have a php script that verifies login status and access rights, and sends the pdf to the client using readfile(). This has worked...
38
Frinavale
by: Frinavale | last post by:
I'm implementing a Silverlight application that uses Sockets to receive data that is pushed to it from a Socket Server. (Silverlight only supports the TCP protocol) The Socket Server pushes a...
6
Markus
by: Markus | last post by:
Things to discuss: Headers What are they? What does PHP have to do with headers? Why can they only be sent before any output? Common causes
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.