shutil.copy in c [英] shutil.copy in c

查看:70
本文介绍了shutil.copy in c的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




是否有一个c库在python中执行shutil.copy2()?基本上

将文件从1个目录复制到另一个目录?


import shutil

import os


shutil.copy2(r" C:\\\\ test",r" C:\ test1 \ test")


谢谢。

Hi,

Is there a c library which does shutil.copy2() in python? Basically
copy a file from 1 directory to another?

import shutil
import os

shutil.copy2(r"C:\test\test",r"C:\test1\test")

Thank you.

推荐答案

yi ***** @ gmail。 com 写道:




是否有ac库在python中执行shutil.copy2() ?基本上

将文件从1个目录复制到另一个目录?
Hi,

Is there a c library which does shutil.copy2() in python? Basically
copy a file from 1 directory to another?



标准C对文件或目录一无所知。

您需要的是特定于操作系统的库函数/系统调用,更好

在与您的系统相关的新闻组中讨论。


-

Pietro Cerutti

PGP公钥:
http://gahr.ch/pgp


文章< 11 ********************** @ 22g2000hsm.googlegroups。 com>,
yi*****@gmail.com < yi ***** @ gmail .comwrote:
In article <11**********************@22g2000hsm.googlegroups. com>,
yi*****@gmail.com <yi*****@gmail.comwrote:

>有没有在python中执行shutil.copy2()的ac库?基本上
将文件从1个目录复制到另一个目录?
>Is there a c library which does shutil.copy2() in python? Basically
copy a file from 1 directory to another?



不在标准C中,没有。

C标准中没有文件复制实用程序。


关于打开文件可能会有通常的响应,

一次读取一个字符并将字符写入输出

文件。但是,文件是指文件。可能有其他属性而不仅仅是

他们的内容(特别是如果文件名是设备!),

并且标准C中无法发现或复制

这些属性。我怀疑python'的shutil.copy2()

*确实*有一种检测和处理这些属性的方法。


在Windows中(根据您提供的文件名,您可能需要复制的属性类别可以包括

备用数据流和安全权限。

-

好​​吧,只有流行语。两个音节,上衣。 - Laurie Anderson

Not in standard C, no. There is no file copy utility in the
C standard.

There will likely be the usual responses about opening the file,
reading it a char at a time and writing the chars to an output
file. However, "files" may have attributes other than just
their contents (especially if the filename is a device!),
and there is no way in standard C to discover or duplicate
those attributes. I would suspect that python''s shutil.copy2()
*does* have a way of detecting and dealing with those attributes.

In Windows (based upon the filenames you gave), the sort
of attributes you might want copied could include the
alternate data streams, and the security rights.
--
Okay, buzzwords only. Two syllables, tops. -- Laurie Anderson


Pietro Cerutti< ga ** @ gahr.chwrites:
Pietro Cerutti <ga**@gahr.chwrites:
yi ***** @ gmail.com 写道:

>是否有交流库哪个在python中执行shutil.copy2()?基本上
将文件从1个目录复制到另一个目录?
>Is there a c library which does shutil.copy2() in python? Basically
copy a file from 1 directory to another?



标准C对文件或目录一无所知。

您需要的是特定于操作系统的库函数/系统调用,更好

在与您的系统相关的新闻组中讨论。


Standard C doesn''t know anything about files or directories.
What you need is an OS-specific library function / system call, better
discussed in a newsgroup related to your system.



它不知道目录,但它确实知道一两件关于文件的



-

Keith Thompson(The_Other_Keith) ks***@mib.org < http://www.ghoti.net/~kst>

圣地亚哥超级计算机中心< *< http://users.sdsc.edu/~kst>

我们必须做点什么。这是事情。因此,我们必须这样做。

- Antony Jay和Jonathan Lynn,是部长

It doesn''t know about directories, but it does know a thing or two
about files.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"


这篇关于shutil.copy in c的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆