Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Perl: Общие вопросы > How to send files !


Автор: viktorijakup 12.9.2008, 14:28
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.

Код

#!/usr/bin/perl
use warnings;
use strict;
use File::Path;
use Cwd;
use File::Copy;
use File::Spec::Functions;
#hardcoded
my $FP = 'D:\conv';
my $TP = 'X:\sgml_db';
my ($from_file, $to_file) = ($ARGV[0], $ARGV[0]);
my $cwd = `cd`;
chomp $cwd;
my ($from_dir, $to_dir) = ($cwd, $cwd);
#rename dir part
$to_dir =~ s/^\Q$FP\E/$TP/;
mkpath($to_dir);
copy(catfile($from_dir, $from_file), catfile($to_dir, $to_file))
or die "can't copy file";
exit 0;


Thank you smile

Автор: shamber 12.9.2008, 15:24
Hi viktorijakup, 

You need add to script cycle.

Автор: viktorijakup 15.9.2008, 09:16
Hello !!!

I attached 2 files. In this pictures, you can view, what I want to get for result from script.

user posted image


  smile 

Автор: shamber 15.9.2008, 09:44
viktorijakup, i'am so stupid. 

i can't understand how you chose file in script.

You want use right click sent-to menu or what?

Автор: viktorijakup 15.9.2008, 12:14

 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.

 smile 

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)