Hello, I would like to use R to process a list of text strings. The text strings are filenames, encoding experimental settings. Based on the information in there I'd like to select certain files and copy only the selected files to another directory. The files are images and there is no need, actually no desire, to open them. Is there a way to use R for copying and pasting files with any file extension to another directory without opening them? Thanks already for any help, Kim __________________________________________ Kim Milferstedt University of Illinois at Urbana-Champaign Department of Civil and Environmental Engineering 4125 Newmark Civil Engineering Laboratory 205 North Mathews Avenue MC-250 Urbana, IL 61801 USA phone: (001) 217 333-9663 fax: (001) 217 333-6968 email: milferst at uiuc.edu http://cee.uiuc.edu/research/morgenroth
Kim Milferstedt wrote:> Hello, > > I would like to use R to process a list of text strings. The text > strings are filenames, encoding experimental settings. Based on the > information in there I'd like to select certain files and copy only > the selected files to another directory. > > The files are images and there is no need, actually no desire, to > open them. Is there a way to use R for copying and pasting files with > any file extension to another directory without opening them? > > Thanks already for any help, > > Kim > > __________________________________________ > > Kim Milferstedt > University of Illinois at Urbana-Champaign > Department of Civil and Environmental Engineering > 4125 Newmark Civil Engineering Laboratory > 205 North Mathews Avenue MC-250 > Urbana, IL 61801 > USA > phone: (001) 217 333-9663 > fax: (001) 217 333-6968 > email: milferst at uiuc.edu > http://cee.uiuc.edu/research/morgenroth >Hi Kim, Try to have a look at : R> apropos("copy") R> ?file.copy Cheers, Romain -- Mango Solutions data analysis that delivers Tel: +44(0) 1249 467 467 Fax: +44(0) 1249 467 468 Mob: +44(0) 7813 526 123
You don't tell us your OS, but the system() command should let you use your OS to copy/move files on most OSs. see ?system Other commands that might be helpful for this job are: ?setwd ?getwd ?dir ----- Original Message ----- From: "Kim Milferstedt" <milferst at uiuc.edu> To: <r-help at stat.math.ethz.ch> Sent: Monday, March 12, 2007 8:33 AM Subject: [R] R for copying and pasting selected image files?> Hello, > > I would like to use R to process a list of text strings. The text > strings are filenames, encoding experimental settings. Based on the > information in there I'd like to select certain files and copy only > the selected files to another directory. > > The files are images and there is no need, actually no desire, to > open them. Is there a way to use R for copying and pasting files with > any file extension to another directory without opening them? > > Thanks already for any help, > > Kim > > __________________________________________ > > Kim Milferstedt > University of Illinois at Urbana-Champaign > Department of Civil and Environmental Engineering > 4125 Newmark Civil Engineering Laboratory > 205 North Mathews Avenue MC-250 > Urbana, IL 61801 > USA > phone: (001) 217 333-9663 > fax: (001) 217 333-6968 > email: milferst at uiuc.edu > http://cee.uiuc.edu/research/morgenroth > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
On 3/12/2007 9:33 AM, Kim Milferstedt wrote:> Hello, > > I would like to use R to process a list of text strings. The text > strings are filenames, encoding experimental settings. Based on the > information in there I'd like to select certain files and copy only > the selected files to another directory. > > The files are images and there is no need, actually no desire, to > open them. Is there a way to use R for copying and pasting files with > any file extension to another directory without opening them? > > Thanks already for any help,You don't say what platform you're using, but copying files is an operating system task, so that's important. If you know how to do one copy on the command line, then you can use R's system() or shell() functions to execute many copies. e.g. on Windows, to copy c:\dir1\foo to c:\dir2\bar you would use shell("copy c:\\dir1\\foo c:\\dir2\\bar")) You need shell() because "copy" is an internal command in Windows, not an .exe. You need to double the backslashes because R treats them as escape characters. Duncan Murdoch
Dear Kim, Try: ?files I think this is all you need :). hth, Paul Kim Milferstedt schreef:> Hello, > > I would like to use R to process a list of text strings. The text > strings are filenames, encoding experimental settings. Based on the > information in there I'd like to select certain files and copy only > the selected files to another directory. > > The files are images and there is no need, actually no desire, to > open them. Is there a way to use R for copying and pasting files with > any file extension to another directory without opening them? > > Thanks already for any help, > > Kim > > __________________________________________ > > Kim Milferstedt > University of Illinois at Urbana-Champaign > Department of Civil and Environmental Engineering > 4125 Newmark Civil Engineering Laboratory > 205 North Mathews Avenue MC-250 > Urbana, IL 61801 > USA > phone: (001) 217 333-9663 > fax: (001) 217 333-6968 > email: milferst at uiuc.edu > http://cee.uiuc.edu/research/morgenroth > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +31302535773 Fax: +31302531145 http://intamap.geo.uu.nl/~paul
Reasonably Related Threads
- nested if/else very slow, more efficient ways?
- removing a specific number of digist from a character string
- update index in "for" statement during calculation
- barplot with different color combination for each bar
- which points within an ellipsoid? Sorting data in 3d