-
Notifications
You must be signed in to change notification settings - Fork 0
/
randomnamer.R
33 lines (31 loc) · 1.15 KB
/
randomnamer.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
########## Changes date of clip files to random if filename info has more than 7 characters#############
scriptStatsRemoveAll <- "~/Pllist.git/RemoveAllExceptFuncs.R"
source(scriptStatsRemoveAll) #clear bones
source("~/Local.R")
setwd('D:/PNMTALL/rpdnclips')
load('~/mfnfo.RData') # load fnfo, lsst, wpls and xx
lsst=mfnfo$lsst
lsstn=gsub('_REN','',lsst)
bn=gsub('[a-z|A-Z]','',lsstn)
bc=gsub('[0-9]','',lsstn)
bn=substr(bn,1,nchar(bn)-2)
namer=mfnfo
namer$mtime=file.mtime(mfnfo$lsst)
namer$mlsst=namer$lsst
namer$lsst=gsub('_REN','',namer$lsst)
namer$bn=as.integer(bn)
namer$info=bc
namer$ofn=NA
namer=namer[!duplicated(namer$lsst),]
nn=(namer[nchar(namer$info)>7,])
nx=nn[sample(order(nn$mtime)),c(2,7)]
nx$lsst=nn$lsst
mtime=nx$mtime
svtO=nx$lsst
dtn=mtime+(6*3600) #add 6 hours to make GMT
fn=normalizePath(as.character(svtO),winslash = '/')
dx=data.frame(dtn,fn,times=NA)
dx$times=paste('Y:',getYear(dx$dtn),' M:',getMonth(dx$dtn),' D:',getDay(dx$dtn),' H:',as.POSIXlt(dx$dtn)$hour,
' I:',as.POSIXlt(dx$dtn)$min,' S:' ,as.POSIXlt(dx$dtn)$sec,sep='')
cmd=paste('shell(','"fdate',dx$fn,dx$times,'")')
eval(parse(text=cmd))