[R] Moving a file from one location to another

Berend Hasselman bhh at xs4all.nl
Wed Oct 17 14:59:41 CEST 2012


On 17-10-2012, at 13:53, Rui Barradas wrote:

> Hello,
> 
> On Windows this should be the old DOS command RENAME (or REN) and apparently the R function ?file.rename carries it's name.
> 

If I'm reading the help for file.rename correctly it can't move a file from one directory to another on Windows ("On Windows,file.rename nowadays works across volumes for files but not directories.". If I remember correctly one will have to use system() and the command move.
Assuming that the OP wants to move files from within R (with cut and paste of course)

Berend


> And yes, the question is terrible. It also shows poor use of the help system. I didn't know the function name but got it right at the second try:
> 
> ?file   # no, other stuff
> ?file.copy  # yes
> 
> Hope this helps,
> 
> Rui Barradas
> Em 17-10-2012 12:27, R. Michael Weylandt escreveu:
>> On Wed, Oct 17, 2012 at 12:11 PM, Berend Hasselman <bhh at xs4all.nl> wrote:
>>> On 17-10-2012, at 10:49, Rantony wrote:
>>> 
>>>> Hi ,A simple question, How we can move a file from one location to another ?
>>>> (i mean cut & paste)Can any one help fast please ?Thanks in advance- Antony
>>>> 
>>> What does this have to with R?
>>> Will depend on the system you are using.
>>> Look in the help of your file manager.
>>> 
>>> Berend
>> As I have said to "Rantony" multiple times before: this is an OS
>> operation so you'll likely need to use the system() function to give
>> your OS the command.
>> 
>> The exact form of the command given depends on your (unstated!) OS but
>> on Unices its usually some variant on
>> 
>> mv A B
>> 
>> However, I also know that Rantony is on Windows so he'll need a
>> different command.
>> 
>> To Rantony: please try to improve the quality of your questions. I've
>> explained multiple times what we look for in a question on this list
>> and you've really shown very little attempt to improve. At the end of
>> the day, we are all just volunteers here, so help us help you. You
>> might even learn something in the process. And please _please_ quote
>> context if you must post from Nabble.
>> 
>> Michael
>> 
>> ______________________________________________
>> R-help at r-project.org 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.
> 




More information about the R-help mailing list