#!/usr/bin/perl

use strict;
use warnings;
use diagnostics;
use File::Find ();
if(-d $ARGV[0]){ chdir $ARGV[0] }
if(!$ARGV[0]) { print "no arg\n"; exit; }

#File::Find::find( sub {
File::Find::finddepth( sub {
	return unless -w;
	return if /^\./;
	my $old = $_;
	s/ /_/g;
#	s/_-_/-/g;
	s/(\w)/lc($1)/ge;
#	s/^[^a-zåäö]*//;
	s/^[^\^a-zåäöA-ZÅÄÖ0-9]*//;

	s/\x86/å/g;
	s/\x84/ä/g;
	s/\x94/ö/g;
	s/__/_/g;
	
	next if $old eq $_;

	print $old . " | " . $_ . "\n";
#	if(-d $_) { print $old . " | " . $_ . "\n" }
	rename $old,$_;

#	print "\n\n";

} , '.');
	

