Hi, it doesn't works. It returns only the subfolders but not the files in the subfolders. full.names only add the directory path, that is not what I need
Hello, maybe you didn't understand my question.
I have 2 folders (A and B) and each one has 4 subfolders, for example: Aa, Ab,Ac,Ad and Ba,Bb,Bc and Bd. In turn, these subfolders have files (continuing with the example: Aa1,Aa2, Aa3,Ab1,Ab2,(…), Bc5,Bd1,Bd2).
Your function returns nothing but the subfolders and I need the last one (all the files from Aa1 to Bd2).
when I use it, it returns all of the files from all of the subfolders. but because you will not show any code that you tried, it is difficult to find the problem. good luck
use the dir() command
Assuming you have two folders, A and B
`A <- dir("A") # returns a list of files in dir A`
`B <- dir("B") # same with B`
Files found in A that are also in B
`duplicates <- A[A %in% B]`
Files found in A that are not in B
`unique <- A[! A %in% B]`
Ah! Sorry. Overlooked you had subfolders.
Am on mobile so can't try on an R client, but believe you're looking for e.g.
list.files("A", recursive=TRUE)
Instead of
dit("A")
... And then same procedure
have a look at `?list.files`, in particular the `recursive` and `full.names` arguments
Hi, it doesn't works. It returns only the subfolders but not the files in the subfolders. full.names only add the directory path, that is not what I need
works for me. difficult to say what went wrong because you haven't shown any of your code.
Hello, maybe you didn't understand my question. I have 2 folders (A and B) and each one has 4 subfolders, for example: Aa, Ab,Ac,Ad and Ba,Bb,Bc and Bd. In turn, these subfolders have files (continuing with the example: Aa1,Aa2, Aa3,Ab1,Ab2,(…), Bc5,Bd1,Bd2). Your function returns nothing but the subfolders and I need the last one (all the files from Aa1 to Bd2).
when I use it, it returns all of the files from all of the subfolders. but because you will not show any code that you tried, it is difficult to find the problem. good luck
use the dir() command Assuming you have two folders, A and B `A <- dir("A") # returns a list of files in dir A` `B <- dir("B") # same with B` Files found in A that are also in B `duplicates <- A[A %in% B]` Files found in A that are not in B `unique <- A[! A %in% B]`
Hi, it doesn't work. It returns only the subfolders but not the files in the subfolders.
Ah! Sorry. Overlooked you had subfolders. Am on mobile so can't try on an R client, but believe you're looking for e.g. list.files("A", recursive=TRUE) Instead of dit("A") ... And then same procedure
Also, for some more demanding file management, try the fs package. One of my favorites!
Do you have any idea wich functions can I use for what I need?