Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: Shorten windows paths too long

by SuicideJunkie (Priest)
on Aug 17, 2010 at 19:21 UTC ( #855575=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Shorten windows paths too long
in thread Shorten windows paths too long

What if you were to build a multilevel hash to lookup the conversions?

BFS the filesystem tree, and rename the first folder you see to 'a', the second to 'b' and so on using the magic increment. Recurse down the tree until you have 'c:\RootOfEvil\a\b\a\c\a\a\f\a\b\filename.ext'

Your hash tree would tell you that $treeHash->{a}{b}{a}{c}...{f}{a}{b} was originally named 'debug' and $treeHash->{a}{b}{a}{c}...{f}{a} was originally named 'bin', and so on, so that you can undo the renames later.

You'd end up renaming 'c:\RootOfEvil\BigNameLevel1' to 'c:\RootOfEvil\a', and then moving on to rename 'c:\RootOfEvil\a\BigNameLevel2' to 'c:\RootOfEvil\a\a' and so on.


Or, much more simply... what if you just pile the whole tree into an archive, copy that across, and then unpack it on the other side, leaving the archiver app to deal with the excessive tree :)


Comment on Re^3: Shorten windows paths too long
Select or Download Code
Re^4: Shorten windows paths too long
by gj2666 (Sexton) on Aug 18, 2010 at 15:32 UTC
    Or, much more simply... what if you just pile the whole tree into an archive, copy that across, and then unpack it on the other side, leaving the archiver app to deal with the excessive tree :)

    Um yeah, zip utilities generally crash on pathname too long. (i've already got that t-shirt)

    Hmm. magic increment. I will continue to investigate. Thanks for the suggestions.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://855575]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (11)
As of 2014-10-20 23:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (93 votes), past polls