简体   繁体   English

在SVN中的目录中搜索具有特定文件扩展名的文件,然后复制到另一个文件夹?

[英]Search directory in SVN for files with specific file extension and copy to another folder?

I would like my python script to search through a directory in SVN, locate the files ending with a particular extension (eg. *.exe), and copy these files to a directory that has been created in my C drive. 我希望我的python脚本搜索SVN中的目录,找到以特定扩展名结尾的文件(例如* .exe),然后将这些文件复制到在C驱动器中创建的目录中。 How can I do this? 我怎样才能做到这一点? I'm new to Python so a detailed response and/or point in the right direction would be very much appreciated. 我是Python的新手,所以非常感谢您提供详细的响应和/或指出正确的方向。

Follow-up: When using os.walk what parameter would I pass in to ensure that I'm copying files with a specific extension (eg. *.exe)? 后续措施:使用os.walk时,我将传入什么参数以确保我正在复制具有特定扩展名的文件(例如* .exe)?

I think it is easiest to check out (or, better, export) the source tree using the svn command line utility: you can use os.system to invoke it. 我认为使用svn命令行实用工具检出(或更好地导出)源树是最容易的:您可以使用os.system来调用它。 There are also direct Python-to-svn API bindings, but I would advise against using them if you are new to Python. 也有直接的Python到svn API绑定,但是如果您不熟悉Python,我建议不要使用它们。

You can then traverse the checkout folder, eg using os.walk; 然后,您可以遍历checkout文件夹,例如使用os.walk;。 the copying itself can be done with shutil.copy. 复制本身可以使用shutil.copy完成。

暂无
暂无

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

相关问题 如何复制具有特定扩展名的文件夹目录中的文件,然后将其保存到新文件夹中而不覆盖已复制的文件? - How do I copy files in a folder directory with a specific extension and save it to a new folder with out overwriting copied files? Python:在目录树中复制具有特定扩展名的文件 - Python: Copy files with specific extension in a tree of directory 搜索具有特定条件的某些文件,并将所有文件复制到另一个文件夹python中 - Search for certain files with specific condition and copy all files in another folder python 尝试将具有特定扩展名的文件从源文件夹复制到目标文件夹 - Trying to copy files with a specific extension from source folder to destination folder 在 SVN 中搜索特定文件 - Search SVN for specific files 如何将具有特定文件扩展名的文件复制到我的python(2.5版)脚本中的文件夹中? - How do I copy files with specific file extension to a folder in my python (version 2.5) script? 使用面料复制具有特定扩展名的文件夹 - Copy folder with specific extension with fabric 有选择地将文件从一个文件夹目录复制到另一个文件夹 - Selectively copy files from one folder directory to another 如何选择具有特定文件名的文件并将其从一个目录复制到另一个目录? - How to select and copy files with specific file names from one directory to another? 如何在整个目录中查找具有特定扩展名的文件,然后将其复制到另一台服务器 - How to look for a file with a particular extension in the entire directory and then copy to another server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM