Advertisement
Guest User

Untitled

a guest
Dec 17th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. znajdzPliki<-function(dir,ext,by="size",recursive=TRUE)
  2. {
  3. stopifnot((by=="size"|by=="time"),is.logical(recursive),
  4. is.character(dir),is.character(ext),length(dir)==1,
  5. length(recursive)==1,length(ext)>0,
  6. length(list.files(dir))>0)
  7. n<-length(ext)
  8. x<-list.files(dir,
  9. pattern=stri_paste("\\.",
  10. stri_paste(ext[-n],"|",collapse=""),ext[n],"$")
  11. ,recursive=recursive)
  12.  
  13. x1<-file.path(dir,x)
  14. y<-file.info(x1)[c(1,5)]
  15. y1<-data.frame(sicezka_wzgledna=x,size=y$size,time=y$ctime)
  16.  
  17. y2<-y1[order(y1[,by],decreasing =("size"==by)),]
  18. rownames(y2)=1:nrow(y2)
  19. y2
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement