for i in $(cat name.txt);do mv ${i}_* ${i} done

https://www.jianshu.com/p/c9da06d451b9

点击查看代码
fs = list.files('./GSE136001_RAW/',pattern = '^GSM')
samples <- substr(fs,1,10)
lapply( unique(samples), function(x){
  y = fs[grepl(x,fs)]
  folder = paste0('./GSE136001_RAW/',strsplit(y[1],split = '-f')[[1]][1])
  #创建文件夹
  dir.create(folder,recursive = T)
  #重命名子文件夹并移动到相应的文件夹中
  file.rename(paste0('./GSE136001_RAW/',y[1]),file.path(folder,"barcodes.tsv.gz"))
  file.rename(paste0('./GSE136001_RAW/',y[2]),file.path(folder,"features.tsv.gz"))
  file.rename(paste0('./GSE136001_RAW/',y[3]),file.path(folder,"matrix.mtx.gz"))
})
posted on 2023-07-18 13:51  Bonjour_!  阅读(13)  评论(0编辑  收藏  举报