0

My problem is with system2 syntax.

I am trying to rename filenameA to filenameB in linux. but I need to use full qualified paths, and rename does not like this, so I propose to use "mv".

I plan use system2 and "mv" (eventually with map) to march across my list of original filenames and new filenames, but I am doing something wrong with system2 as the following code demonstrates:

  • first I show you a single filename,
  • then I use file.info() to show that file.info() can find the single file,
  • then I show you the system2 "fail"
  • then I show the recovered linux command issued by system2 succeeding in the shell.

Suggestions?

here is a single filename

monthlyzipinfo[1] [1] "/home/rob/KRBD_Data/Client_ID/000/raw/monthzips/2015-01/Data_2015-01-07.zip"

here is the result from file.info

file.info(monthlyzipinfo[1])

                                                                        size isdir mode               mtime

/home/rob/KRBD_Data/Client_ID/000/raw/monthzips/2015-01/Data_2015-01-07.zip 3911 FALSE 664 2017-05-17 09:38:18 ctime atime uid gid /home/rob/KRBD_Data/Client_ID/000/raw/monthzips/2015-01/Data_2015-01-07.zip 2017-05-17 11:37:29 2017-05-17 09:27:48 1000 1000 uname grname /home/rob/KRBD_Data/Client_ID/000/raw/monthzips/2015-01/Data_2015-01-07.zip rob rob

but system2 fails

system2(paste("ls -la", monthlyzipinfo[1])) sh: 1: ls -la /home/rob/KRBD_Data/Client_ID/000/raw/monthzips/2015-01/Data_2015-01-07.zip: not found

but if I cut and paste the linux command from system2, that works;

rob@NewMachine:~$ ls -la /home/rob/KRBD_Data/Client_ID/000/raw/monthzips/2015-01/Data_2015-01-07.zip -rw-rw-r-- 1 rob rob 3911 May 17 09:38 /home/rob/KRBD_Data/Client_ID/000/raw/monthzips/2015-01/Data_2015-01-07.zip rob@NewMachine:~$

user2292410
  • 447
  • 4
  • 13

0 Answers0