Hi community
Im use list.files()
for get .jpg files for many folders. Im want to obtain name of folder, file and Accesion. Im try to remove and extract but only is good for the first and last rows.
Other example was try with mutate()
for each path but don't run well.
library(tidyverse)
library(stringr)
list_file3 <- data.frame(Folder_path=c("1ra ENTREGA 2022 100 Acc/G 24.jpg", "1ra ENTREGA 2022 100 Acc/G 114.jpg",
"2da ENTREGA 2022 100 Acc/G 1678.jpg", "2da ENTREGA 2022 100 Acc/G 2220.jpg",
"3ra ENTREGA 2022 27 Acc/G24888.jpg", "3ra ENTREGA 2022 27 Acc/G35109.jpg",
"4ta ENTREGA 2022 100 Acc/G 1653.jpg", "4ta ENTREGA 2022 100 Acc/G 1767.jpg",
"5ta ENTREGA 2022 100 Acc/G10703.jpg", "5ta ENTREGA 2022 100 Acc/G10705.jpg",
"6ta ENTREGA 2022 100 Acc/G13418.jpg", "6ta ENTREGA 2022 100 Acc/G13425.jpg",
"7a ENTEGA 2022 100 Acc/G11134.jpg", "7a ENTEGA 2022 100 Acc/G11158.jpg",
"8va ENTREGA 2022 119 Acc/G23816C.jpg", "8va ENTREGA 2022 119 Acc/G23834E.jpg"))
path <- c('1ra ENTREGA 2022 100 Acc/', '2da ENTREGA 2022 100 Acc/',
'3ra ENTREGA 2022 27 Acc/', '4ta ENTREGA 2022 100 Acc/',
'5ta ENTREGA 2022 100 Acc/','6ta ENTREGA 2022 100 Acc/',
'7a ENTEGA 2022 100 Acc/', '8va ENTREGA 2022 119 Acc/')
list_file3 |>
mutate(Entrega=str_extract(Folder_path,path)) |>
mutate(file= str_remove(Folder_path,path)) |>
mutate(Accesion=str_remove(file,'\\.jpg$'))
Tnks!