首页 > 代码库 > R语言 复制文件,复制目录

R语言 复制文件,复制目录



file.info

file.create

dir.create

file.copy


if(!dir.exists("Result_Dir")){
        dir.create("Result_Dir")
    }
setwd("Result_Dir")

# Folder _ 2

dir.create("2_test", showWarnings = TRUE, recursive = FALSE)

if(file.exists("Result.xls")){
    file.rename("Result.xls", "2_test/Result.xls" )
}

    

# Folder _ 3

dir.create("4_test/T3_results", showWarnings = TRUE, recursive = TRUE)



参考:


http://astrostatistics.psu.edu/su07/R/html/base/html/files.html


http://stackoverflow.com/questions/10266963/moving-files-between-folders



http://r.789695.n4.nabble.com/copy-directory-command-td881914.html



http://r.789695.n4.nabble.com/copyING-directories-and-files-td960879.html

> list.files(".")
                              
[1] "R_plot"                                 "R_test"                                  
[3] "result_Annotation.xls"                    "Rg"                                      
[5] "sample.ped"                               "sample.ped.LD"                           
[7] "sample.ped.LD.PNG"                        "Tree_plot.txt"                      
[9] "Youku Files"                              "T_T.py"                                  

> file.info("Tree_plot.txt")$isdir
[1] FALSE

> !isTRUE(file.info("Tree_AT")$isdir)
[1] TRUE
> file.info("Tree_AT")$isdir


本文出自 “R和Python应用” 博客,请务必保留此出处http://matrix6ro.blog.51cto.com/1746429/1904021

R语言 复制文件,复制目录