I have multiple zipfiles that i already unzipped but i wanna rename them.
my first section of the commands worked, but the second part isn't working.
my files are named as : JobID-82_H4_BHS_2014_Import
JobID can be one digit, two or three digits, and i want to extract "BHS" part. So i might have to backtrack (from 13 to 15 starting from the end)
but it's not working..
local unzipdir "U:\blah"
local files : dir "`unzipdir'" files "*.dta"
foreach file of local files {
local cty_iso = substr("`file'",15,13)
local fname = "`cty_iso'.dta"
copy "`unzipdir'/`file'" "`sourcedir'/`fname'", replace
}
my first section of the commands worked, but the second part isn't working.
my files are named as : JobID-82_H4_BHS_2014_Import
JobID can be one digit, two or three digits, and i want to extract "BHS" part. So i might have to backtrack (from 13 to 15 starting from the end)
but it's not working..
local unzipdir "U:\blah"
local files : dir "`unzipdir'" files "*.dta"
foreach file of local files {
local cty_iso = substr("`file'",15,13)
local fname = "`cty_iso'.dta"
copy "`unzipdir'/`file'" "`sourcedir'/`fname'", replace
}
Comment