Re: How can I use system cmd with variables?
Derek Parnell wrote:
>
> Dan Moyer wrote:
> > But shouldn't it be:
> > system("rename " & folderPathName & "\\" & oldFileNames[n] & " "
> > & newFileNames[n], 2)
>
> I assumed that because you didn't have the "\\" that it was already appended
> to the end of the pathname. If not then the sprintf way is very neat.
Yes, I did already make it have "\\" at the end of the pathname, I forgot
when I suggested the above; your second way worked *fine*, THANKS :)
>
> system(sprintf("rename \"%s\\%s\" %s",
> {folderPathName,
> oldFileNames[n],
> newFileNames[n]})
> , 2)
>
> I have the quotes surrounding the 'from' name because you mentioned that it
> contains embedded spaces.
Ok, I wasn't sure why, but it sure worked fine
Dan
>
> --
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell
|
Not Categorized, Please Help
|
|