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

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -