I would just use fi <- file.info(dir(path, recursive=TRUE, include.dirs=TRUE)) path could be the OneDrive directory or Scotland (and is not needed if you're already in the directory you want). Then rownames(subset(fi, isdir)) will contain all the directories. Maybe you want to use grep or other machinery to thin it out. Regards, Jorgen Harmse.? ---------------------------------------------------------------------- Message: 1 Date: Mon, 20 May 2024 14:36:58 +0100 From: Nick Wray <nickmwray at gmail.com <mailto:nickmwray at gmail.com>> To: r-help at r-project.org <mailto:r-help at r-project.org> Subject: [R] Listing folders on One Drive Message-ID: <CABxY9BM35aW7Np7kkVybAZm_HN8_5uZ0x017b1Wq5=dS4wEN2g at mail.gmail.com <mailto:dS4wEN2g at mail.gmail.com>> Content-Type: text/plain; charset="utf-8" Hello I have lots of folders of individual Scottish river catchments on my uni One Drive. Each folder is labelled with the river name eg "Tay" and they are all in a folder named "Scotland" I want to list the folders on One Drive so that I can cross check that I have them all against a list of folders on my laptop. Can I somehow use list.files() - I've tried various things but none seem to work... Any help appreciated Thanks Nick Wray [[alternative HTML version deleted]]