I have many .csv files in a folder. I want to get the binning result from each of the .csv file one by one automatically by R scripting from command line, and one by one write the result of all files into result.csv file. For example, I have file01.csv, file02.csv, file03.csv, file04.csv, file05.csv. I want that first R script will read / execute file01.csv and write the result into result.csv file, then read / execute file02.csv and write result into result.csv, again read / execute file03.csv and write result into result.csv, and so on. This is like a loop on all the files, and I want to execute the R script from the command line.

Here is my starting R script:

```
data <- read.table("file01.csv",sep=",",header = T)

df.train <- data.frame(data)

library(smbinning)　# Install if necessary

<p>#Analysis by dwell:</p>

df.train_amp <-
rbind(df.train)

res.bin <- smbinning(df=df.train_amp, y="cvflg",x="dwell")

res.bin      #Result

<p># Analysis by pv</p>
df.train_amp <-
rbind(df.train)

res.bin <- smbinning(df=df.train_amp, y="cvflg",x="pv")

res.bin   #Result

```

Any suggestion and support would be appreciated highly. 

Thank