using R to copy files

前端 未结 2 1060
难免孤独
难免孤独 2020-12-23 20:25

As part of a larger task performed in R run under windows, I would like to copy selected files between directories. Is it possible to give within R a command like cp p

2条回答
  •  南笙
    南笙 (楼主)
    2020-12-23 21:22

    You can

    • use system() to fire off a command as if it was on shell, incl globbing
    • use list.files() aka dir() to do the globbing / reg.exp matching yourself and the copy the files individually
    • use file.copy on individual files as shown in mjv's answer

提交回复
热议问题