#!perl -w use strict; my $dir = "E:/Perl/bin/test"; chdir($dir); print "Type c to crypt, u to uncrypt: "; chomp(my $stdin = ); opendir(DIR, $dir); foreach my $file(readdir(DIR)) { if(!-d $file ) { my $copy = $file; $file =~s/\.HID$// if $stdin eq "u"; substr($file, length($file), 0) = '.HID' if $stdin eq "c" && $file !~/\.HID$/; rename($copy, $file); } } closedir(DIR);