[R] Copy and Rename Folder in same directory

Ben Tupper btupper at bigelow.org
Mon May 8 13:12:30 CEST 2017


My eye gets drawn immediately to file.rename() - did you give that a shake?



> On May 8, 2017, at 6:59 AM, Archit Soni <soni.archit1989 at gmail.com> wrote:
> 
> Hey Ben,
> 
> I tried this,
> 
> # identify the folders
> current.folder <- "C:/Where my files currently live"
> new.folder <- "H:/Where I want my files to be copied to"
>  
> # find the files that you want
> list.of.files <- list.files(current.folder, "SDM\\.tif$",full.names=T)
>  
> # copy the files to the new folder
> file.copy(list.of.files, new.folder)
> 
> But i am still getting FALSE and files are not getting copied from the folder. However,if I give a single file name it copies that file to new folder.
> 
> Any thoughts ?
> 
> On Mon, May 8, 2017 at 4:07 PM, Archit Soni <soni.archit1989 at gmail.com <mailto:soni.archit1989 at gmail.com>> wrote:
> Thanks Ben. :)
> 
> On May 8, 2017 16:06, "Ben Tupper" <btupper at bigelow.org <mailto:btupper at bigelow.org>> wrote:
> Hi,
> 
> Checkout all of the functions for file/directory management under ?files  (note the plural).
> 
> Cheers,
> Ben
> 
> 
> > On May 8, 2017, at 6:30 AM, Archit Soni <soni.archit1989 at gmail.com <mailto:soni.archit1989 at gmail.com>> wrote:
> >
> > Hello,
> >
> > Forgive me to ask this kind of naive question.
> >
> > But it would be of immense help if you could help me suggesting a way to
> > copy a folder in the same directory and paste it in the same directory with
> > different name.
> >
> > Ex:
> >
> > C:/Folder A -- C:/Folder A_B
> >
> > Contents should be copied as is.
> >
> > Thanks for reading and thanks in advance!
> >
> > Archit
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at r-project.org <mailto:R-help at r-project.org> mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help <https://stat.ethz.ch/mailman/listinfo/r-help>
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html <http://www.r-project.org/posting-guide.html>
> > and provide commented, minimal, self-contained, reproducible code.
> 
> Ben Tupper
> Bigelow Laboratory for Ocean Sciences
> 60 Bigelow Drive, P.O. Box 380
> East Boothbay, Maine 04544
> http://www.bigelow.org <http://www.bigelow.org/>
> 
> 
> 
> 
> 
> 
> -- 
> Regards
> Archit

Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org




	[[alternative HTML version deleted]]



More information about the R-help mailing list