[R] Zip multiple files with same prefix?

Ista Zahn istazahn at gmail.com
Fri May 23 15:56:38 CEST 2014


Something like

files <- list.files()
groups <- unique(substr(files, 1, 7))

for(goup in groups) {
      zip(paste0(group, ".zip"), grep(group, files, value=TRUE))
}

should get you started.

Best,
Ista

On Thu, May 22, 2014 at 3:34 PM, mr_kirkwood <rkirkwo2 at uwyo.edu> wrote:
> I have thousands of files that need to be zipped. The files that need to be
> zipped together have the same seven digit prefix e.g. 40111h1.
>
> I am a novice at R-Studio and would appreciate some help on this matter.
>
> Thanks!
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Zip-multiple-files-with-same-prefix-tp4691088.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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