daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /usr/bin/env python
  2. # -*- coding: UTF-8 -*-
  3.  
  4. import os, sys
  5.  
  6. assert len (sys.argv) == 3
  7.  
  8. d1 = os.path.abspath (sys.argv [1])
  9. assert os.path.isdir (d1)
  10. d2, d3 = os.path.split (d1)
  11. d4 = os.path.abspath (sys.argv [2])
  12. assert os.path.isdir (d4)
  13. d5 = os.path.join (d4, d3)
  14. assert not os.path.exists (d5)
  15.  
  16. for s in os.walk (d1) :
  17.     assert not os.path.samefile (s [0], d4)
  18.  
  19. n = len (os.path.join (d1, ''))
  20.  
  21. for u, v, w in os.walk (d1) :
  22.     x = u [n : ]
  23.     y = os.path.join (d1, x)
  24.     z = os.path.join (d5, x)
  25.     os.mkdir (z)
  26.     for s in w :
  27.         os.link (os.path.join (y, s), os.path.join (z, s))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top