belege umbenannt
This commit is contained in:
+25
-1
@@ -450,7 +450,7 @@ if(ok){
|
||||
anz <- length(eintraege)
|
||||
for(ind in 1:length(eintraege)){
|
||||
if( exists(paste0(zielpfad, eintraege[ind])) ){
|
||||
cat(ind, " von ", anz, "\n")
|
||||
cat(ind, " von ", anz, "\n")
|
||||
file.copy(
|
||||
from = paste0(pfad, vorhanden[ind]),
|
||||
to = "~/Documents/workspace/gemfin-shiny/www/documents/")
|
||||
@@ -498,3 +498,27 @@ dbDisconnect(con_f)
|
||||
|
||||
print("Migration finished.")
|
||||
|
||||
|
||||
## * Dateien umbenennen ----
|
||||
library("tools")
|
||||
atts <- dbReadTable(conn, "attachments")
|
||||
sum(duplicated(atts$id)) == 0
|
||||
pfad <- "www/attachments/"
|
||||
for( ind in 1:nrow(atts)){
|
||||
datei <- atts$original_name[ind]
|
||||
if( file.exists(paste0(pfad, datei)) ){
|
||||
# print(ind)
|
||||
ext <- file_ext(datei)
|
||||
idwert <- atts$id[ind]
|
||||
if(is.na(idwert)) break
|
||||
name_neu <- paste0(idwert,".",ext)
|
||||
print(name_neu)
|
||||
file.copy(from = paste0(pfad, datei), to=paste0("www/documents/", name_neu), overwrite = T)
|
||||
}
|
||||
}
|
||||
atts %>%
|
||||
filter(id == 1379)
|
||||
|
||||
which( "1379.pdf" %in% atts$original_name)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user