file.copy
Jeff, Thank you so much for your help. Below are the revised code (done with your hints) that has worked and the console. I have just added - overwrite=TRUE) to file.copy(). Pradip ############################################### #file.copy.jn.way.R #identify the folders fromFolder <- "H:/R/cis_study" toFolder <- "F:/cis_study_backup" # find the list of files to copy list.of.files <- list.files(fromFolder, ".R$") # print objects print(c(fromFolder, toFolder, list.of.files)) options(warn=1) # copy the files to the toFolder - THIS DOES NOT WORK WHILE EVERYTHING PRIOR HAS WORKED file.copy(file.path(fromFolder,list.of.files), toFolder, overwrite=TRUE) ################### revised console ########################
#file.copy.jn.way.R #identify the folders fromFolder <- "H:/R/cis_study" toFolder <- "F:/cis_study_backup" # find the list of files to copy list.of.files <- list.files(fromFolder, ".R$") # print objects print(c(fromFolder, toFolder, list.of.files))
[1] "H:/R/cis_study" "F:/cis_study_backup" [3] "anl.in.scope_111114.R" "create.oid.data.frame.R" [5] "create_xd2012.R" "file.copy.R" [7] "file.copy_Duncan_way.R" "further.data.R" [9] "mrj.in.scope_111214.R" "oid.in.scope_111114.R" [11] "oid_cohort.R" "warning.max.R" [13] "xdate.R" "years.before.anl.init.R" [15] "years.before.mrj.init.R" "years.before.oid.init.R"
options(warn=1) # copy the files to the toFolder - THIS DOES NOT WORK WHILE EVERYTHING PRIOR HAS WORKED file.copy(file.path(fromFolder,list.of.files), toFolder, overwrite=TRUE)
[1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
Pradip K. Muhuri, PhD SAMHSA/CBHSQ 1 Choke Cherry Road, Room 2-1071 Rockville, MD 20857 Tel: 240-276-1070 Fax: 240-276-1260