简体   繁体   English

如何使用Python识别USB驱动器并将其用作复制文件和目录的目标路径

[英]How to use Python to identify Usb drives and use them as Destination paths for copying files and directories

Was wondering how I could implement python to assist me in copying files to/from different USB port devices. 想知道如何实现python来协助我将文件复制到不同的USB端口设备或从不同的USB端口设备复制文件。 After trying to find a way to get the path of USB input devices I found that they are instance devices and therefore do not give paths. 在尝试找到获取USB输入设备路径的方法后,我发现它们是实例设备,因此不提供路径。 I saw something about PyUsb that could possibly aid in what i'm trying to accomplish, but I wanted to see if there were any better options. 我看到了有关PyUsb的信息,可能有助于我尝试完成的工作,但我想看看是否有更好的选择。 My end goal is to be able to write a script that all you need to do is plug in the destination paths and it should copy all of the contents from one drive to another. 我的最终目标是能够编写一个脚本,您所需要做的就是插入目标路径,并且该脚本应该将所有内容从一个驱动器复制到另一个驱动器。 Please note that I am not asking for code but simply possible tools that could aid me as I try to put this project together myself! 请注意,我并不是在索要代码,而是在我自己尝试将该项目组合在一起时可能会提供帮助的简单工具! Please Advise! 请指教!

I understand that you're looking for some references to get yourself started, however you are asking on the wrong section of stack. 我了解您正在寻找一些入门参考,但是您在询问错误的堆栈部分。 You should be going to Stack Exchange and posting your question over there using the proper tags. 您应该去Stack Exchange,并使用适当的标签在此处发布问题。 Stack Overflow is typically used when you already have found the resources you're going to use, and you've encountered an error when trying to create or implement something using them 当您已经找到要使用的资源,并且尝试使用它们创建或实现某些东西时遇到错误时,通常使用堆栈溢出

But to get you started, I would suggest using PyUSB which is a python implementation of LibUSB 但是,为了让您入门,我建议您使用PyUSB ,它是LibUSB的python实现

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM