If this is a one-time change, it will be simpler to use the Windows File explorer (I assume Windows since you are using backslashes). If it needs to be done using R functions, this seems to work:
> dir.create("A/B/C/D/E", recursive=TRUE) > list.dirs("A") [1] "A" "A/B" "A/B/C" "A/B/C/D" "A/B/C/D/E" > file.rename("A/B/C/D", "A/B/D") [1] TRUE > list.dirs("A") [1] "A" "A/B" "A/B/C" "A/B/D" "A/B/D/E" > file.rename("A/B/C", "A/B/D/C") [1] TRUE > list.dirs("A") [1] "A" "A/B" "A/B/D" "A/B/D/C" "A/B/D/E" > file.rename("A/B/D/E", "A/B/D/C/E") [1] TRUE > list.dirs("A") [1] "A" "A/B" "A/B/D" "A/B/D/C" "A/B/D/C/E" ------------------------------------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -----Original Message----- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Kristi Glover Sent: Saturday, October 1, 2016 6:29 AM To: r-help@r-project.org Subject: [R] Rearranging sub-folders, how? Hi R user, I was wondering how we can rearrange the folders in R. for example original data has been put with the following arrangement: foldA\subFoldB\subFoldC\subFoldD\subFoldE\ SubFoldE contains several dataset I want to rearrange the subFoldE into following sequence: foldA\subFoldB\subFoldD\subFoldC\subFoldE\ Any suggestions? Thanks [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.