Leser: 3
|< 1 2 3 4 >| | 32 Einträge, 4 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!perl -w
use strict;
my $dir = "E:/Perl/bin/test";
chdir($dir);
opendir(DIR, $dir);
foreach my $file(readdir(DIR)) {
if(!-d $file ) {
if($file =~/\.HID$/) {
my $cut = substr($file, -4); #HIER STIMMT WAS NICHT
rename($file, $cut);
}
}
}
#if(!$file =~/^\./) { rename($file, "$file\.HID"); }
closedir(DIR);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!perl -w
use strict;
my $dir = "E:/Perl/bin/test";
chdir($dir);
opendir(DIR, $dir);
foreach my $file(readdir(DIR)) {
if(!-d $file ) {
my $copy = $file;
$file =~s/\.HID$//i;
$file =~s//\.HID$/i; #ABER WARUM GEHT DAS NUN NICHT???
rename($copy, $file);
}
}
#if(!$file =~/^\./) { rename($file, "$file\.HID"); }
closedir(DIR);
Quote$ find . -type r -exec mv {} {}.HID \;
$ find . -name '*.HID' -exec my_shell_script {} \;
1
2
3
4
5
6
$file =~s/\.HID$//i; # entfernt .HID
$file =~s//\.HID$/i; # habs auch schon gemerkt.. ist schwachsinn,,.
#also:
$file =~s/.*?/.*?\.HID$/i;
#sieht total doof aus und funzt auch nicht, wie denn nu??
1
2
3
4
5
6
7
8
9
10
11
12
use File::Copy;
my @files = <"$ENV{ DOCUMENT_ROOT }/config/*.*">;
foreach( @files )
{
my $success = move( "$ENV{ DOCUMENT_ROOT }/config/$_", "$ENV{ DOCUMENT_ROOT }/config/$_.HID" );
if( !$success )
{
print "Fehler beim Umbennen von Datei $_\n";
}
}
1
2
3
4
5
6
7
$file = 'file.txt';
substr($file, length($file), 0) = '.bak';
print "$file\n";
$file = 'file.txt';
$file =~ s/$/\.bak/;
print "$file\n";
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!perl -w
use strict;
my $dir = "E:/Perl/bin/test";
chdir($dir);
print "Type c to crypt, u to uncrypt: ";
chomp(my $stdin = <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);
|< 1 2 3 4 >| | 32 Einträge, 4 Seiten |