Created
September 8, 2022 19:27
-
-
Save allaway/80f7bfce3e8ca4aadc93b9338215a418 to your computer and use it in GitHub Desktop.
Rename folder or files on synapse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(synapser) | |
| synLogin() | |
| ids <- synTableQuery("SELECT id FROM syn11601459 where name like '%28NF%' and type = 'file'")$asDataFrame()$id | |
| sapply(ids, function(x){ | |
| foo <- synGet(x, downloadFile=F) | |
| nx <- stringr::str_replace(foo$properties$name, "28NF", "28cNF") | |
| foo$properties$name <- nx | |
| synStore(foo) | |
| }) | |
| ids <- synTableQuery("SELECT id FROM syn11601459 where name like '%28NF%' and type = 'folder'")$asDataFrame()$id | |
| sapply(ids, function(x){ | |
| foo <- synGet(ids[[1]], downloadFile=F) | |
| nx <- stringr::str_replace(foo$properties$name, "28NF", "28cNF") | |
| foo$properties$name <- nx | |
| synStore(foo) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment