467,104 Members | 1,055 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

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

How to sent file ?!

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;
  6. my $sDest = 'X:/whatever';
  7. mkpath $sDest;
  8. copy('D:/whatever/bbb.doc', qq{$sDest/MMC1.doc});
Sep 3 '08 #1
  • viewed: 1058
3 Replies
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} );
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:  $!";
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.


Sep 3 '08 #2
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:
.........and so on....
Constant path is "D:\conv", doesn't change
For example:
I must send from

selective "TOC.doc" file to


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;
  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: $!";
Thank you !

Sep 4 '08 #4

Post your reply

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

Similar topics

1 post views Thread by a c s | last post: by
4 posts views Thread by Q | last post: by
4 posts views Thread by zelzel.zsu@gmail.com | last post: by
3 posts views Thread by Lars Netzel | last post: by
1 post views Thread by Piotrekk | last post: by
9 posts views Thread by John C. Frickson | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.