Don't like ads? PRO users don't see any ads ;-)
Guest

copy_all_users_profile

By: FATruden on Sep 17th, 2012  |  syntax: Python  |  size: 1.08 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #-------------------------------------------------------------------------------
  2. # Name:        Copy_all_profile
  3. # Purpose:
  4. #
  5. # Author:      mgres6161 (Alexander Rudenko)
  6. #
  7. # Created:     14.09.2012
  8. # Copyright:   (c) mgres6161 2012
  9. # Licence:     <Free>
  10. #-------------------------------------------------------------------------------
  11. #!/usr/bin/env python
  12. import os
  13. import sys
  14. import subprocess
  15. #
  16. profile_dir_xcopy = """"C:\\Documents and Settings\\\""""
  17. distination_path = "\\\ws-30-01-13-03\\test\\"
  18. #
  19. comp_name = input("Local comp name :") + """\\"""
  20. #
  21. full_profile_path = profile_dir_xcopy + "*"
  22. full_distination_path = distination_path + comp_name
  23. #
  24. path = full_profile_path+" "+full_distination_path
  25. PIPE = subprocess.PIPE
  26. p = subprocess.Popen("xcopy /E/H/K/O/C/I /EXCLUDE:\\\ws-30-01-13-03\\PP\\ecept.txt %s" \
  27.     %path, shell=True, \
  28.     stdin=PIPE, stdout=PIPE, stderr=subprocess.STDOUT)
  29. #
  30. while True:
  31.     s = p.stdout.readline()
  32.     if not s: break
  33.     print(s)
  34. #
  35. print("complidet!")
  36.  
  37. #
  38. #def main():
  39. #    pass
  40.  
  41. if __name__ == '__main__':
  42.     main()