By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,807 Members | 1,995 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,807 IT Pros & Developers. It's quick & easy.

How to send files ?!

P: 10
Hi !!!

I have script, which sends file to current directory, but script sends 1 file in 1 runing script.

I need script, which sends several file, (I select and mark files myself) in 1 runing script.

What I must add to this script.

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2. use warnings;
  3. use strict;
  4. use File::Path;
  5. use Cwd;
  6. use File::Copy;
  7. use File::Spec::Functions;
  8. #hardcoded 
  9. my $FP = 'D:\conv';
  10. my $TP = 'X:\sgml_db';
  11. my ($from_file, $to_file) = ($ARGV[0], $ARGV[0]);
  12. my $cwd = `cd`;
  13. chomp $cwd;
  14. my ($from_dir, $to_dir) = ($cwd, $cwd);
  15. #rename dir part
  16. $to_dir =~ s/^\Q$FP\E/$TP/;
  17. mkpath($to_dir);
  18. copy(catfile($from_dir, $from_file), catfile($to_dir, $to_file)) 
  19.     or die "can't copy file";
  20. exit 0;
Thank you !
Sep 12 '08 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 2.5K+
P: 3,503
How are you supplying the file names you want to copy? However you do, you would just use a loop to cycle through a list of those files, sending them one at a time.


Sep 12 '08 #2

P: 10
Hi !!!

My method of selecting files is simple.

I open folder, select files with "Panel control commands: Ins or Shift + cursor keys" and run script.

Sep 15 '08 #3

Post your reply

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