tannx has asked for the wisdom of the Perl Monks concerning the following question:
I found script to encode files to utf-16#!/usr/bin/perl use warnings; use strict; use File::Copy; my $srcdir = "C:\\ROOT_DIR\\1\\"; my $dest = "C:\\ROOT_DIR\\2\\"; my (@files); for (;;) { opendir(DIR, $srcdir) or die "Can't open $srcdir: $!"; @files = grep {!/^\.+$/} readdir(DIR); close(DIR); if (!@files) { print "Done.\n\n"; last; } my $file = $files[0]; my $old = "$srcdir/$file"; move($old, $dest) or die "Move $old -> $dest failed: $!"; print "File Name: $file 5 seconds til next.\n\n"; sleep 5; }
I'm unable to combine those scripts together.#!/usr/bin/perl use strict; use warnings; binmode(STDOUT, ':raw:encoding(UTF-16)'); for my $qfn (@ARGV) { open(my $fh, "<:raw:encoding(UTF-8)", $qfn) or die("Can't open \"$qfn\": $!\n"); print while <$fh>; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: encode files to utf-16 and then move
by moritz (Cardinal) on May 08, 2009 at 08:39 UTC | |
|
Re: encode files to utf-16 and then move
by ikegami (Patriarch) on May 08, 2009 at 16:28 UTC | |
by tannx (Acolyte) on May 11, 2009 at 13:08 UTC | |
by ikegami (Patriarch) on May 11, 2009 at 14:11 UTC | |
by Anonymous Monk on May 11, 2009 at 13:19 UTC | |
by tannx (Acolyte) on May 25, 2009 at 13:04 UTC |