Last active
          August 30, 2025 17:01 
        
      - 
      
- 
        Save timb-machine/bdae1fd4012f996dd13d5cba8a4155d0 to your computer and use it in GitHub Desktop. 
    encode-in-tree.pl
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/usr/bin/perl | |
| use Cwd; | |
| use MIME::Base64; | |
| $start = getcwd(); | |
| $maxnewpath = 1024; | |
| while (sysread(STDIN, $byte, 1) != 0) { | |
| $maxpath = 100; | |
| $string = $byte; | |
| while ((sysread(STDIN, $byte, 1) != 0) && ($maxpath > 0)) { | |
| $string .= $byte; | |
| $maxpath --; | |
| } | |
| $string .= $byte; | |
| $string = encode_base64($string); | |
| $string =~ s/\x0a//g; | |
| $string =~ s/\x0d//g; | |
| mkdir($string); | |
| chdir($string); | |
| $maxnewpath = $maxnewpath - length($string); | |
| if (($maxnewpath - length($string)) < 0) { | |
| chdir($start); | |
| $maxnewpath = 1024; | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment