Schrift
[thread]8673[/thread]

255 Character für Dateistruktur

Leser: 1


<< >> 2 Einträge, 1 Seite
schiffne
 2007-01-23 15:14
#73536 #73536
User since
2007-01-23
1 Artikel
BenutzerIn
[default_avatar]
Hallo zusammen,

ich habe ein Problem bei der Indentifizierung von Files und Foldern die zusammen über eine Länge von 255 Zeichen hinausgehen. Am ende des Tages hätte ich gerne einen TXT file der die Pfade zu diesen Dateien beinhaltet:
z.B.:
D:\Documents and Settings\Hans Mustermann\My Documents\Eigene Musik\Fredrik Vahle Dietlind Grabe - Glitzerschnee und Knoblauchpizza\Glitzerschnee und Knoblauchpizza\Fredrik Vahle - Dietlind Grabe - Schneefl&”ckchen, weiss R&”ckchen.mp3
D:\Documents and Settings\Hans Mustermann\My Documents\Eigene Musik\Fredrik Vahle Dietlind Grabe - Glitzerschnee und Knoblauchpizza\Glitzerschnee und Knoblauchpizza\Fredrik Vahle - Dietlind Grabe - Wo wohnt wohl der Weihnachtsmann.mp3


Vielleicht hat ja schonmal ein ähnliches Problem gehabt. Im Internet konnte ich nur folgendes Script finden.
Code: (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#
# *****************************************************************
# Filename: LongPathLocator.pl
# Original Author: Dick Lewis MCSE, MCT, MCP + Internet, A+
# Original Contact: [EMAIL PROTECTED]
# Original Date: 10/04/1999
# Original Purpose: This script is designed capture long paths
# inside the directory structure on a remote sharepoint
# or on a local machine. As paths reach 255 characters and beyond
# users will experience limited accessibily to there data and copy,
# edit, save and delete operations can be impacted negatively.
# The script then builds a series of HTML reports that are
# uniquely named based on the directory name.
# The length of path you want to test for is configurable
# and the reports show the actual length of the path.
# If no files are beyond the configured path threshold then the
# report is still produced but contains a line of text reporting there
# are no long paths detected.
#
# Adapted by: Urs Rau [EMAIL PROTECTED]
# New usage: To report on files which have a path length of over 64 chars
# which is a problem for the freedos booted unattended installer.
#
# First: Install ActivePerl available at [URL=http://www.activestate.com]http://www.activestate.com[/URL]
# on the computer where the script will run.
#
# CONFIG STEP #1: Enter the target directory where you want to test path length.
# Example: $Target_Directory = "\\\\Seattle\\Sales\\Reports";
#
# CONFIG STEP #2: Enter the path length threshold for testing.
# Example: $Length="200";
#
# CONFIG STEP #3: Configure the report name and location.
# $DIR must be in the report name.
# Example: $OPTFILE = "c:\\TEMP\\output$DIR.html";
#
# This script was tested using:
# ActivePerl build 519 available at [URL=http://www.activestate.com.]http://www.activestate.com.[/URL]
# Remember to use double \\back slashes
# in your path modifications below. Example: C:\\TestDir\\Fred
# or for a remote path \\\\Fileserver12\\publicshare
# Use this script carefully and test it in a
# non-production environment prior to deployment.
# *****************************************************************
#

use Getopt::Long;
use File::Basename;

# Get the time to put in the report;
$last_updated = localtime (time);

$args = @ARGV;
&GetOptions(\%options, 'dir:s', 'threshold:i', 'prefix:s', 'outdir:s', "help"
=> \$help);
if ($args < 2) {
$help = 1;
}
if ($help) {
die "usage: $0 [-h|--help show this help] -dir z:\\os\\winxppro
[-threshold 64] [-outdir c:\\temp] [-prefix winxppro]\n";
}
# CONFIG STEP #1: Enter the default target directory where you want to test path length.
# Example: $Target_Directory = $options{dir} || "\\\\Seattle\\Sales\\Reports";
$Target_Directory = $options{dir} || "d:\\docume~1";

# CONFIG STEP #2: Enter the default path length threshold for testing.
# Example: $Threshold = $options{threshold} || 200;
$Threshold = $options{threshold} || 64;

# Get the list of directories for directing
# the DIR command and naming the report. Load
# array @DirList with this data.
@DirList = `dir /AD /B $Target_Directory\\*`;
foreach $DIR ( @DirList ) {
# Chomp the $DIR variable to remove newline character.
chomp($DIR);

# Display on screen message on building file list.
print "Building list of files in $dirname directory\n\n";

# Configure the report name prefix and location here.

# CONFIG STEP #3: Report prefix
#
# Example: $OUTFILE = "prefix";
$PREFIX = $options{prefix} || "prefix";

# CONFIG STEP #4: Report directory
#
# Example: $OUTDIR = "$OUTDIR\\$PREFIX-$DIR.html";
$OUTDIR = $options{outdir} || "d:\\web\\";

# CONFIG STEP #5: Configure the report name and location here.
# $DIR must be in the report name.
# Example: $OPTFILE = "c:\\temp\\prefix-$DIR.html";
$OPTFILE = "$OUTDIR\\$PREFIX-$DIR.html";

# Display on screen message that report is being built.
print "Currently writing report to $OPTFILE\n\n";

# Open the output file.
open(OUTPUTFILE, ">$OPTFILE")|| die "open0: $!";

# Initialize the file counter with a blank value
$Counter = 0;

# Build the top of the HTML report containing
# $DIR, $last_updated and $Length variables.
# Escape out Perl reserved characters. Examples: \= and \".
print OUTPUTFILE <<ENDHTML;
<html><head><title>Long Path Report</title></head>
<body BGCOLOR="#FFFFFF" TOPMARGIN="1" LEFTMARGIN="1" ALINK="#666699"
LINK="#336699" vLink="#336699>
<p><font face="Verdana, Arial"><img src="ban_IS.JPG" width="319" height="90"
border="0" alt="Information Systems"></font></p>
<p><big><strong>Long Path Report for $dirname Folder</strong></big></p>
<p><font color="#000000">Last Updated: $last_updated<br>
Path length in</font><font color="#FF0000"> [red]</font><font
color="#000000">--All paths listed over $Threshold characters.</p>
<hr></font><div align="left"><table border="0" width="700" cellspacing="1">
ENDHTML

# Load array with Dir command results on target directory.
# Double quotes prevent DIR command failure due to spaces
# in directory names.
open(DIRCMD, "dir /S /B /A \"$Target_Directory\\$DIR\"\\*|") or die "Unable
to open dir on $DIR.\n";

# For each of the files test length.
while ($File = <DIRCMD>) {
$File =~ /\S/ or next;
chomp($File);

# Extract dirname for $File
$dirname = dirname("$File");

# If length is greater than the configured number.
if (($Length = length($dirname)) > $Threshold) {

# Display on screen path length and path.
print "$Length\t$File\n";

# Increment the counter.
$Counter++;

# Output to file the counter number, length of path
# and full path to file or folder.
print OUTPUTFILE <<ENDHTML;
<tr><td width="710" height="20" align="left">$Counter&nbsp;&nbsp;<font
color="#FF0000">[$Length]</font>&nbsp;&nbsp;$File</td></tr>
ENDHTML

}
}
# If the counter file has not been incremented it indicates
# no long paths were detected and the message needs to be displayed.
unless ($Counter) {

# Print message to screen and output to file.
print "No long file paths over $Threshold characters were detected in the
$dirname folder.\n\n";
print OUTPUTFILE "No long file paths over $Threshold characters were
detected in the $dirname folder.";
}
# Print the final report tags to the output file and close file.
print OUTPUTFILE "</table></div><p>&nbsp;</p></body></html>";
close(OUTPUTFILE) or die "close0: $!";

# Copy the file to the WebReports area.
# rename ("c:\\TEMP\\output_$DIR.html", "d:\\Web\\output$DIR.html");
}


Hat vielleicht eine Idee und kann mir helfen. Am besten wäre eine pl die folgendermaßen gestartet wird:

LONGFILENAME.pl -source "D:\Documente und Einstellungen" -letters 255 -text c:\test.txt

Danke und vielen Dank fuer Eure Hilfe
Marco\n\n

<!--EDIT|renee|1169558307-->
renee
 2007-01-23 15:20
#73537 #73537
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Was genau soll das Programm machen?

Das gepostete Programm benutzt die Windows-Funktion dir. Kann durchaus sein, dass das Probleme macht. Das sollte in Perl-interne Funktionen (opendir,...) umgeschrieben werden.
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/
<< >> 2 Einträge, 1 Seite



View all threads created 2007-01-23 15:14.