Advertisement
stream13

Linkmaker

Nov 3rd, 2013
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import os
  4. import sys
  5.  
  6. chain_len = 10
  7. prefix = "link_"
  8.  
  9. if ( len( sys.argv ) > 1 ):
  10.     if( len( sys.argv ) > 2 ):
  11.         chain_len = int( sys.argv[2] )
  12.         if( len( sys.argv ) > 3 ):
  13.             prefix = sys.argv[3]
  14.     os.system( "ln -s " + sys.argv[1] + " " + prefix + "0" )
  15.     for i in range ( 1, chain_len ):
  16.         os.system( "ln -s " + prefix + str(i-1) + " " + prefix + str(i) )
  17.  
  18. else:
  19.     print "ERROR: No filename given!\n"
  20.     print "USAGE:"
  21.     print "\t" + sys.argv[0] + " [TARGET FILE] [LENGHT] [PREFIX]\n"
  22.     print "\tParamethers [LENGHT] and [PREFIX] are optional."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement