uos_example.py 857 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #
  2. # Copyright (c) 2006-2019, RT-Thread Development Team
  3. #
  4. # SPDX-License-Identifier: MIT License
  5. #
  6. # Change Logs:
  7. # Date Author Notes
  8. # 2019-06-13 SummerGift first version
  9. #
  10. import uos
  11. print("Get the current directory:")
  12. print(uos.getcwd())
  13. print("Create folder: rtthread")
  14. uos.mkdir("rtthread")
  15. print("List the files in the current directory:")
  16. print(uos.listdir())
  17. print("Move the current directory to the rtthread folder:")
  18. uos.chdir("rtthread")
  19. print("Get the current directory:")
  20. print(uos.getcwd())
  21. print("Switch to the previous directory:")
  22. uos.chdir("..")
  23. print("Get the current directory:")
  24. print(uos.getcwd())
  25. print("List the files in the current directory:")
  26. print(uos.listdir())
  27. print("Delete the rtthread folder:")
  28. uos.rmdir("rtthread")
  29. print("List the files in the current directory:")
  30. print(uos.listdir())