Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computing > NZ Computing > Check path length in Windows hierarchy?

Reply
Thread Tools

Check path length in Windows hierarchy?

 
 
KiwiBrian
Guest
Posts: n/a
 
      10-05-2005
Is there a utility or program that I can point at a top level folder in a
hierarchy and it will tell me of any files whose total path-length including
file-name exceeds a predefined figure?
It appears that Windows allows this situation to be created, thus ensuring
some unpredictable side-effects, none of them good.
I have not been able to find any way of checking a current existing
situation, which seems a bit bizarre.
TIA
Brian Tozer


 
Reply With Quote
 
 
 
 
Harry
Guest
Posts: n/a
 
      10-05-2005
KiwiBrian wrote:

> Is there a utility or program that I can point at a top level folder in a
> hierarchy and it will tell me of any files whose total path-length
> including file-name exceeds a predefined figure?
> It appears that Windows allows this situation to be created, thus ensuring
> some unpredictable side-effects, none of them good.
> I have not been able to find any way of checking a current existing
> situation, which seems a bit bizarre.


find / | awk 'length($0}>255{print $0}'

 
Reply With Quote
 
 
 
 
KiwiBrian
Guest
Posts: n/a
 
      10-05-2005

"Harry" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> KiwiBrian wrote:
>
>> Is there a utility or program that I can point at a top level folder in a
>> hierarchy and it will tell me of any files whose total path-length
>> including file-name exceeds a predefined figure?
>> It appears that Windows allows this situation to be created, thus
>> ensuring
>> some unpredictable side-effects, none of them good.
>> I have not been able to find any way of checking a current existing
>> situation, which seems a bit bizarre.

>
> find / | awk 'length($0}>255{print $0}'


Thanks Harry.
What would I have to do to run this on a Windows XP SP2 PC?
Brian Tozer


 
Reply With Quote
 
Harry
Guest
Posts: n/a
 
      10-05-2005
KiwiBrian wrote:

>
> "Harry" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> KiwiBrian wrote:
>>
>>> Is there a utility or program that I can point at a top level folder in
>>> a hierarchy and it will tell me of any files whose total path-length
>>> including file-name exceeds a predefined figure?
>>> It appears that Windows allows this situation to be created, thus
>>> ensuring
>>> some unpredictable side-effects, none of them good.
>>> I have not been able to find any way of checking a current existing
>>> situation, which seems a bit bizarre.

>>
>> find / | awk 'length($0}>255{print $0}'

>
> Thanks Harry.
> What would I have to do to run this on a Windows XP SP2 PC?
> Brian Tozer


Install gnu stuff.
Have a nice day.

 
Reply With Quote
 
Malcolm
Guest
Posts: n/a
 
      10-05-2005
On Thu, 06 Oct 2005 02:32:31 +1300, KiwiBrian wrote:

>
> "Harry" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> KiwiBrian wrote:
>>
>>> Is there a utility or program that I can point at a top level folder in a
>>> hierarchy and it will tell me of any files whose total path-length
>>> including file-name exceeds a predefined figure?
>>> It appears that Windows allows this situation to be created, thus
>>> ensuring
>>> some unpredictable side-effects, none of them good.
>>> I have not been able to find any way of checking a current existing
>>> situation, which seems a bit bizarre.

>>
>> find / | awk 'length($0}>255{print $0}'

>
> Thanks Harry.
> What would I have to do to run this on a Windows XP SP2 PC?
> Brian Tozer

Hi Brian
I think awk should be available on Windows services for Unix, it's a
free download here;

http://www.microsoft.com/windowsserv...u/default.mspx

--
Cheers
Malcolm

 
Reply With Quote
 
Alan
Guest
Posts: n/a
 
      10-05-2005
"KiwiBrian" <(E-Mail Removed)> wrote in message
news:dhvckv$ts6$(E-Mail Removed)
> Is there a utility or program that I can point at a top level folder
> in a hierarchy and it will tell me of any files whose total
> path-length including file-name exceeds a predefined figure?
> It appears that Windows allows this situation to be created, thus
> ensuring some unpredictable side-effects, none of them good.
> I have not been able to find any way of checking a current existing
> situation, which seems a bit bizarre.
> TIA
> Brian Tozer
>


Hi,

If it was me, I'd just use excel as being quick and simple, but
obviously you would need to have that available.

Alan.

--
The views expressed are my own, and not those of my employer or anyone
else associated with me.

My current valid email address is:

http://www.velocityreviews.com/forums/(E-Mail Removed)

This is valid as is. It is not munged, or altered at all.

It will be valid for AT LEAST one month from the date of this post.

If you are trying to contact me after that time,
it MAY still be valid, but may also have been
deactivated due to spam. If so, and you want
to contact me by email, try searching for a
more recent post by me to find my current
email address


 
Reply With Quote
 
Mark C
Guest
Posts: n/a
 
      10-05-2005
"KiwiBrian" <(E-Mail Removed)> wrote in
news:di0kl6$987$(E-Mail Removed):

>
> "Harry" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> KiwiBrian wrote:
>>
>>> Is there a utility or program that I can point at a top level
>>> folder in a hierarchy and it will tell me of any files whose
>>> total path-length including file-name exceeds a predefined
>>> figure? It appears that Windows allows this situation to be
>>> created, thus ensuring
>>> some unpredictable side-effects, none of them good.
>>> I have not been able to find any way of checking a current
>>> existing situation, which seems a bit bizarre.

>>
>> find / | awk 'length($0}>255{print $0}'

>
> Thanks Harry.
> What would I have to do to run this on a Windows XP SP2 PC?
> Brian Tozer


dir /b/s | gawk "length($0}>255{print $0}"

Get gawk here:
http://unxutils.sourceforge.net
 
Reply With Quote
 
KiwiBrian
Guest
Posts: n/a
 
      10-06-2005

"Alan" <(E-Mail Removed)> wrote in message
news:ydX0f.16230$(E-Mail Removed)...
> "KiwiBrian" <(E-Mail Removed)> wrote in message
> news:dhvckv$ts6$(E-Mail Removed)
>> Is there a utility or program that I can point at a top level folder
>> in a hierarchy and it will tell me of any files whose total
>> path-length including file-name exceeds a predefined figure?
>> It appears that Windows allows this situation to be created, thus
>> ensuring some unpredictable side-effects, none of them good.
>> I have not been able to find any way of checking a current existing
>> situation, which seems a bit bizarre.
>> TIA
>> Brian Tozer
>>

>
> Hi,
>
> If it was me, I'd just use excel as being quick and simple, but
> obviously you would need to have that available.
>
> Alan.


Hi Alan.
I have Excel available on the PC under discussion.
Could you elaborate on exactly how I can use it to achieve my objective?
TIA
Yours hopefully.
Brian


 
Reply With Quote
 
Alan
Guest
Posts: n/a
 
      10-06-2005
"KiwiBrian" <(E-Mail Removed)> wrote in message
news:di1u3n$lbl$(E-Mail Removed)
> "Alan" <(E-Mail Removed)> wrote in message
> news:ydX0f.16230$(E-Mail Removed)...
>> "KiwiBrian" <(E-Mail Removed)> wrote in message
>> news:dhvckv$ts6$(E-Mail Removed)
>>> Is there a utility or program that I can point at a top level
>>> folder
>>> in a hierarchy and it will tell me of any files whose total
>>> path-length including file-name exceeds a predefined figure?
>>> It appears that Windows allows this situation to be created, thus
>>> ensuring some unpredictable side-effects, none of them good.
>>> I have not been able to find any way of checking a current
>>> existing
>>> situation, which seems a bit bizarre.
>>> TIA
>>> Brian Tozer
>>>

>>
>> Hi,
>>
>> If it was me, I'd just use excel as being quick and simple, but
>> obviously you would need to have that available.
>>
>> Alan.

>
> Hi Alan.
> I have Excel available on the PC under discussion.
> Could you elaborate on exactly how I can use it to achieve my
> objective? TIA
> Yours hopefully.
> Brian


Hi Brian,

Open a new workbook, and paste this sub into a new standard module in
the VB Editor (watch out for wrapping in the news posting):

+-+-+-+-+-+-+-+-+-+-+-+-+

Sub IndexFiles()

' To use, select cell A1 (say) in an empty worksheet, and run this
' code.
' When it completes, you should have a full path listing of all files
' and folders in the named directory and sub-directories.

SearchPath = InputBox("Enter the path to search", "Folder?")

With Application.FileSearch

.LookIn = SearchPath
.FileType = msoFileTypeAllFiles
.SearchSubFolders = True
.Execute

End With

cnt = Application.FileSearch.FoundFiles.Count

For i = 1 To cnt

rng = "A" & i

Range(rng).Value = Application.FileSearch.FoundFiles.Item(i)

Next i

End Sub

+-+-+-+-+-+-+-+-+-+-+-+-+


Go to A1 in an empty worksheet and run the macro above.

Enter a path you want to check such as:

C:\Temp

It will list the full path and filename of each file in that directory
and all sub-directories as text strings in A1 down.

Bear in mind that a worksheet in excel only has 65536 rows so if you
do this for a folder with 70,000 files it'll fall over - in that case
do it for sub-folders one at a time.

Once you have the file listings, enter a formula in B1 thus:

=LEN(A1)

Copy that down as far as the list extends and it will tell you the
total path length for each file.

You could then sort by column B in descending order to see the longest
paths first.


Post back if you need more detail on any of that.

HTH,

Alan.


--
The views expressed are my own, and not those of my employer or anyone
else associated with me.

My current valid email address is:

(E-Mail Removed)

This is valid as is. It is not munged, or altered at all.

It will be valid for AT LEAST one month from the date of this post.

If you are trying to contact me after that time,
it MAY still be valid, but may also have been
deactivated due to spam. If so, and you want
to contact me by email, try searching for a
more recent post by me to find my current
email address



 
Reply With Quote
 
Harry
Guest
Posts: n/a
 
      10-06-2005
Alan wrote:

> "KiwiBrian" <(E-Mail Removed)> wrote in message
> news:di1u3n$lbl$(E-Mail Removed)
>> "Alan" <(E-Mail Removed)> wrote in message
>> news:ydX0f.16230$(E-Mail Removed)...
>>> "KiwiBrian" <(E-Mail Removed)> wrote in message
>>> news:dhvckv$ts6$(E-Mail Removed)
>>>> Is there a utility or program that I can point at a top level
>>>> folder
>>>> in a hierarchy and it will tell me of any files whose total
>>>> path-length including file-name exceeds a predefined figure?
>>>> It appears that Windows allows this situation to be created, thus
>>>> ensuring some unpredictable side-effects, none of them good.
>>>> I have not been able to find any way of checking a current
>>>> existing
>>>> situation, which seems a bit bizarre.
>>>> TIA
>>>> Brian Tozer
>>>>
>>>
>>> Hi,
>>>
>>> If it was me, I'd just use excel as being quick and simple, but
>>> obviously you would need to have that available.
>>>
>>> Alan.

>>
>> Hi Alan.
>> I have Excel available on the PC under discussion.
>> Could you elaborate on exactly how I can use it to achieve my
>> objective? TIA
>> Yours hopefully.
>> Brian

>
> Hi Brian,
>
> Open a new workbook, and paste this sub into a new standard module in
> the VB Editor (watch out for wrapping in the news posting):
>
> +-+-+-+-+-+-+-+-+-+-+-+-+
>
> Sub IndexFiles()
>
> ' To use, select cell A1 (say) in an empty worksheet, and run this
> ' code.
> ' When it completes, you should have a full path listing of all files
> ' and folders in the named directory and sub-directories.
>
> SearchPath = InputBox("Enter the path to search", "Folder?")
>
> With Application.FileSearch
>
> .LookIn = SearchPath
> .FileType = msoFileTypeAllFiles
> .SearchSubFolders = True
> .Execute
>
> End With
>
> cnt = Application.FileSearch.FoundFiles.Count
>
> For i = 1 To cnt
>
> rng = "A" & i
>
> Range(rng).Value = Application.FileSearch.FoundFiles.Item(i)
>
> Next i
>
> End Sub
>
> +-+-+-+-+-+-+-+-+-+-+-+-+
>
>
> Go to A1 in an empty worksheet and run the macro above.
>
> Enter a path you want to check such as:
>
> C:\Temp
>
> It will list the full path and filename of each file in that directory
> and all sub-directories as text strings in A1 down.
>
> Bear in mind that a worksheet in excel only has 65536 rows so if you
> do this for a folder with 70,000 files it'll fall over - in that case
> do it for sub-folders one at a time.
>
> Once you have the file listings, enter a formula in B1 thus:
>
> =LEN(A1)
>
> Copy that down as far as the list extends and it will tell you the
> total path length for each file.
>
> You could then sort by column B in descending order to see the longest
> paths first.
>
>
> Post back if you need more detail on any of that.
>


Gee that is really simple. Clever of MS to provide such a powerful
and user-friendly tool! So simple!

BTW you can get a copy of gawk.exe, on its own, from nearly everywhere
on the internet. You could also do the same thing with perl.exe, viz:

dir /b/s | perl -ne 'print $_ if length($_) > 255;'

Doing it in excel is lame.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting 'Path' in Windows XP (and path length) DW Computer Support 7 01-03-2011 07:29 PM
check path.exists() with a "converted" path Alessandro Python 5 09-27-2010 09:51 AM
check if string contains numeric, and check string length of numeric value ief@specialfruit.be C++ 5 06-30-2005 01:08 PM
How to check if a path *could* be a legal path? Maciej Sobczak Python 9 04-24-2004 11:12 PM
How to get length of string? length() problems Mitchua Perl 5 07-17-2003 12:08 AM



Advertisments