file.info

file.create

dir.create

file.copy

if(!dir.exists("Result_Dir")){        dir.create("Result_Dir")    }setwd("Result_Dir")# Folder _ 2dir.create("2_test", showWarnings = TRUE, recursive = FALSE)if(file.exists("Result.xls")){    file.rename("Result.xls", "2_test/Result.xls" )}    # Folder _ 3dir.create("4_test/T3_results", showWarnings = TRUE, recursive = TRUE)

参考:

> 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