Thread Feststellung ob Dateisystem casesensitive ist (4 answers)
Opened by bianca at 2011-08-12 17:51

murphy
 2011-08-12 20:44
#151547 #151547
User since
2004-07-19
1776 Artikel
HausmeisterIn
[Homepage]
user image
Hier mal ein kleines Skript zum Austesten der Eigenschaften eines Dateisystemes:
Code (perl): (dl )
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env perl
use 5.012;
use warnings;

use Cwd qw/getcwd/;
use File::Temp qw/tempdir/;

my $cwd = getcwd;

for my $fs (@ARGV ? @ARGV : '.') {
    my $dir = tempdir(DIR => $fs, CLEANUP => 1);
    chdir $dir or die "Error in chdir() using $dir: $!";
    
    my ($fold_create, $fold_open, $rename);
    
    if (open my $foo, '>Foo') {
        my %names = map { $_ => 1 } glob('*');
        if ($names{foo}) {
            $fold_create = 'lc';
        }
        elsif ($names{FOO}) {
            $fold_create = 'uc';
        }
        else {
            $fold_create = 'none';
        }
    }
    else {
        die "Error in open() using >Foo: $!";
    }
    
    if (rename 'Foo', 'fOo') {
        $rename = 'allowed';
    }
    else {
        $rename = 'disallowed';
    }
    
    if (open my $foo, '<foO') {
        $fold_open = 'yes';
    }
    else {
        $fold_open = 'none';
    }
    
    chdir $cwd or warn "Error in chdir() using $cwd: $!";
    say "$fs: fold_create=$fold_create, fold_open=$fold_open, rename=$rename";
}


Ergebnisse für verschiedene Kombinationen von Betriebs- und Dateisystem:
Code: (dl )
1
2
3
4
5
6
7
Linux/ext3: fold_create=none, fold_open=none, rename=allowed
Linux/msdos: fold_create=lc, fold_open=yes, rename=allowed
Linux/vfat: fold_create=none, fold_open=yes, rename=allowed
Linux/hfs: fold_create=none, fold_open=yes, rename=allowed
WinXP/FAT: fold_create=none, fold_open=yes, rename=disallowed
WinXP/NTFS: fold_create=none, fold_open=yes, rename=disallowed
WinXP/Ext2Fsd: fold_create=none, fold_open=yes, rename=disallowed
When C++ is your hammer, every problem looks like your thumb.

View full thread Feststellung ob Dateisystem casesensitive ist