2018年5月26日土曜日

[ubuntu] Connect directory of USB device wia Python

(ubuntu 16.04LTS, Python3.6)

A way to connect USB device with python easily. I want to use this for backing up files with some filters, like python files or updated...


1. check Location of USB Drive

USB DISK -> Properties 


















for my ubuntu, Location is /media/shimo
(shimo is my username)

import glob
glob.glob('/media/shimo/**/**.py', recursive=True)

by this we get .py files in USB media

note: path in glob depends on directories in USB device


--
references on stackoverflow is complex...

https://stackoverflow.com/questions/22615750/how-can-the-directory-of-a-usb-drive-connected-to-a-system-be-obtained

0 件のコメント:

コメントを投稿