use Win32::DriveInfo; my $file = 'C:\test\file.txt'; sub fileSizeBlocks { my $file = shift; my ($drive) = $file =~ /^([A-Z])/; my ( $SectorsPerCluster, $BytesPerSector ) = ( Win32::DriveInfo::DriveSpace($drive) )[ 0, 1 ]; my $blockSizeBytes = $SectorsPerCluster * $BytesPerSector; my $fileSizeBytes = ( stat($file) )[7]; my $blocks = int( $fileSizeBytes / $blockSizeBytes ); $blocks++ if ( $fileSizeBytes % $blockSizeBytes ); return $blockSizeBytes * $blocks; } say "Datei '$file' ist ", fileSizeBlocks($file), " groß";