Directory Analyzing Tools HELP!

Scouse

Giant Thundercunt
FH Subscriber
Joined
Dec 22, 2003
Messages
36,048
Chaps

I need a tool that I can run which analyses how long a path is and outputs something to a log file.

Eg> I want to analyse a server's E: drive for path+filename combinations over 255 characters deep and report what there is to a logfile.

(So it may find, say, fifty path+filename combos that are over 255 chars long and outputs them to say output.log).

Anyone? Hellllp!!!
 

sibanac

Fledgling Freddie
Joined
Dec 19, 2003
Messages
824
Scouse said:
Chaps

I need a tool that I can run which analyses how long a path is and outputs something to a log file.

Eg> I want to analyse a server's E: drive for path+filename combinations over 255 characters deep and report what there is to a logfile.

(So it may find, say, fifty path+filename combos that are over 255 chars long and outputs them to say output.log).

Anyone? Hellllp!!!
what os and what languages you got ?
 

Scouse

Giant Thundercunt
FH Subscriber
Joined
Dec 22, 2003
Messages
36,048
OS is Server 2003 (but will need a tool that runs on Win2k too).

And I speak English (just) ;)
 

babs

Can't get enough of FH
Joined
Dec 30, 2003
Messages
1,595
Start > Run > cmd
dir e:\*.* /s > file.txt

open the resultant text file and paste it into excel (or other spreadsheet package). Assuming you pasted it into cell A1, type the following in B1

=LEN(A1)

Copy and fill that formula down. That should show you the figures, but it's still in formula form. Copy the entire column of lengths, then paste special and choose 'values only'. Now do a sort on column B, job done.

Longwinded and archaic maybe, but it'll do the job and uses fairly common software.
 

Scouse

Giant Thundercunt
FH Subscriber
Joined
Dec 22, 2003
Messages
36,048
Thats not gonna work unfortunately. It's going to return *all* the files under a directory structure by directory with the files listed underneath.

I need to search on various dfsroots and there could be several hundred gigabytes of data with only a few files which are over the 255 character path length+filename...


poo innit :(
 

NaveT

Fledgling Freddie
Joined
Dec 22, 2003
Messages
101
The following will work albeit crude. Just dump the contents into a text file and rename it as something.vbs.

Code:
Option Explicit

Call CheckFilePathLength("C:\", "C:\char_logfile.txt" )

Sub CheckFilePathLength(sStartingFilePath, sLogFileLocation)

	Dim oFileSystem, oLogFile
	Set oFileSystem = CreateObject("Scripting.FileSystemObject")

	CreateFile oFileSystem, sLogFileLocation, oLogFile
	Recurse oFileSystem, sStartingFilePath, oLogFile

	oLogFile.Close
	Set oFileSystem = Nothing

	wscript.echo "Finished"

End Sub

Sub Recurse(oFileSystem, sStartingFilePath, oLogFile)

	Dim oRoot, oFiles, cFolder, oFolders, cFile

	Set oRoot = oFileSystem.getfolder(sStartingFilePath)
	Set oFiles = oRoot.Files
	Set oFolders = oRoot.SubFolders

	For Each cFile In oFiles
		on error resume next
		if len(cFile.Path) > 255 then
			 oLogFile.WriteLine (cFile.Path)
			if err then
				wscript.echo "Error:" &  err.description
				wscript.echo "File:" & cFile.Path
				exit sub
			end if
			on error goto 0
		end if

	Next

	For Each cFolder In oFolders
		Recurse  oFileSystem, cFolder.Path, oLogFile
	Next

	Set oRoot = Nothing
	Set oFiles = Nothing
	Set oFolders = Nothing

End Sub

Sub CreateFile(oFileSystem, sLogFileLocation, oLogFile)

	   Set oLogFile = oFileSystem.CreateTextFile(sLogFileLocation, True)

End Sub

I take no responsiblity etc to what this may do on your systems. Use at your own risk.
 

Scouse

Giant Thundercunt
FH Subscriber
Joined
Dec 22, 2003
Messages
36,048
Ta chaps. Checking out suggestions as I type :)
 

babs

Can't get enough of FH
Joined
Dec 30, 2003
Messages
1,595
Oh I see, I mis-read/interpreted. :/
 

Users who are viewing this thread

Top Bottom