larus has asked for the wisdom of the Perl Monks concerning the following question:
This renames and copies the file but only the name of the file, not what it contains. Would you provide some help here? I'm using Windows XP.#!/bin/perl #usage: #C:\Perl>perl Replace_chars_of_files.pl "C:/Perl/" use warnings; use strict; use File::Copy; my $path = $ARGV[0]; die "You must supply a full directory path" unless (-e $path && -d $pa +th); my @dirs; opendir(DIR, $path) || die "can't opendir $path: $!"; my @fileet = grep { -f "$path/$_" } readdir(DIR); closedir(DIR); foreach my $file (@fileet) { $file =~ s/ä/ä/g; $file =~ s/ö/ö/g; move($file, "$path/$file"); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Renaming files in dir
by bart (Canon) on Mar 19, 2009 at 08:33 UTC | |
by larus (Acolyte) on Mar 19, 2009 at 08:57 UTC | |
by bart (Canon) on Mar 19, 2009 at 09:16 UTC | |
|
Re: Renaming files in dir
by cdarke (Prior) on Mar 19, 2009 at 09:06 UTC | |
by larus (Acolyte) on Mar 19, 2009 at 09:17 UTC | |
by Utilitarian (Vicar) on Mar 19, 2009 at 10:18 UTC | |
by larus (Acolyte) on Mar 19, 2009 at 10:37 UTC | |
by larus (Acolyte) on Mar 19, 2009 at 10:56 UTC |