c# - Copy file to directory -
is there no .net library call copying file directory? library calls found (e.g. file.copy()
or fileinfo.copyto()
) support copying file specified file.
string file = "c:\dir\ect\ory\file.txt"; string dir = "c:\other\directory"; file.copy(file, dir); // not work, requires filename
is there library call? if no, what's best way write own utility, have use path.getfilename()
?
do have use path.getfilename()?
exactly:
string destination = path.combine(dir, path.getfilename(file)); directory.createdirectory(dir); file.copy(file, destination);
Comments
Post a Comment