Skip to main content
added 330 characters in body
Source Link
gringer
  • 15.1k
  • 5
  • 24
  • 83

just to complete your question, you can do it in R in one line.

After setting the directory as your working directory, just type the following:

file.rename(list.files(pattern = "vcf"), paste0("A",1:length(list.files(pattern = ".vcf")),".vcf"))

Maybe you can try file.rename(list.files(pattern = ".vcf"), paste0("A",1:length(list.files(pattern = ".vcf")),".vcf")). Also, if there is still an error, can you post the output of list.files(pattern = ".vcf") just to see the structure of your files in folder (maybe one file has a weird name not detected by the pattern).

just to complete your question, you can do it in R in one line.

After setting the directory as your working directory, just type the following:

file.rename(list.files(pattern = "vcf"), paste0("A",1:length(list.files(pattern = ".vcf")),".vcf"))

just to complete your question, you can do it in R in one line.

After setting the directory as your working directory, just type the following:

file.rename(list.files(pattern = "vcf"), paste0("A",1:length(list.files(pattern = ".vcf")),".vcf"))

Maybe you can try file.rename(list.files(pattern = ".vcf"), paste0("A",1:length(list.files(pattern = ".vcf")),".vcf")). Also, if there is still an error, can you post the output of list.files(pattern = ".vcf") just to see the structure of your files in folder (maybe one file has a weird name not detected by the pattern).

Source Link
dc37
  • 1.1k
  • 1
  • 7
  • 14

just to complete your question, you can do it in R in one line.

After setting the directory as your working directory, just type the following:

file.rename(list.files(pattern = "vcf"), paste0("A",1:length(list.files(pattern = ".vcf")),".vcf"))