[R] file.copy

Muhuri, Pradip (SAMHSA/CBHSQ) Pradip.Muhuri at samhsa.hhs.gov
Fri Nov 14 15:13:59 CET 2014


Hello Duncan,

Jeff's tweaks to my code has worked.   Now I am trying your way. Below are the R script and console.   The issue is that the object (list.of.files) has not been created.  Any thoughts?

Thanks,

###############  R script ##########################

#file.copy.dm.way.R

#identify the folders

fromFolder <- file.path("H:", "cis_study")

toFolder <- file.path("F:", "cis_study")

# find the list of files to copied
list.of.files <- list.files(fromFolder, ".R$")

# print objects
print(fromFolder, list.of.files, toFolder)

# copy the files
file.copy(list.of.files, toFiles)

###############  console ###############
> #file.copy.dm.way.R
> 
> #identify the folders
> 
> fromFolder <- file.path("H:", "cis_study")
> 
> toFolder <- file.path("F:", "cis_study")
> 
> # find the list of files to copied
> list.of.files <- list.files(fromFolder, ".R$")
> 
> # print objects
> print(fromFolder, list.of.files, toFolder)
Error in print.default(fromFolder, list.of.files, toFolder) : 
  invalid 'digits' argument
> 
> # copy the files
> file.copy(list.of.files, toFiles)
logical(0)



More information about the R-help mailing list