Dears
I have a bunch of .zip files each with a different name and with 4 different types of file extension (not .dta).
Just to make an example:
2016_RG_01.zip which contains : 2016_RG_01.cpg, 2016_RG_01.dbf, 2016_RG_01.shp, 2016_RG_01.prj
2016_RG_02.zip which contains : 2016_RG_02.cpg, 2016_RG_02.dbf, 2016_RG_02.shp, 2016_RG_02.prj
2016_RG_03.zip which contains : 2016_RG_03.cpg, 2016_RG_03.dbf, 2016_RG_03.shp, 2016_RG_03.prj
2016_RG_04.zip which contains : 2016_RG_04.cpg, 2016_RG_04.dbf, 2016_RG_04.shp, 2016_RG_04.prj
...
I first tried to unzip all of them in an unique folder called unzip. I used the following command which however does not unzip my files.
Could you please help me to understand where the problem of my loop is?
Because I would like to keep only the .dbf and .shp files contained in each zip and save them in different folder (i.e. "H:\shapefiles\unzip\2016_RG_01" for the 2016_RG_01.dbf, 2016_RG_01.shp files) is it possible to add another command in the loop to unzip the different zip files in a different folder and erase the files that I do not need?
Thanks
Federica
I have a bunch of .zip files each with a different name and with 4 different types of file extension (not .dta).
Just to make an example:
2016_RG_01.zip which contains : 2016_RG_01.cpg, 2016_RG_01.dbf, 2016_RG_01.shp, 2016_RG_01.prj
2016_RG_02.zip which contains : 2016_RG_02.cpg, 2016_RG_02.dbf, 2016_RG_02.shp, 2016_RG_02.prj
2016_RG_03.zip which contains : 2016_RG_03.cpg, 2016_RG_03.dbf, 2016_RG_03.shp, 2016_RG_03.prj
2016_RG_04.zip which contains : 2016_RG_04.cpg, 2016_RG_04.dbf, 2016_RG_04.shp, 2016_RG_04.prj
...
I first tried to unzip all of them in an unique folder called unzip. I used the following command which however does not unzip my files.
Code:
capture log close local sourcedir "H:\shapefiles" local unzipdir "H:\shapefiles\unzip" cap noi mkdir "`unzipdir'" local fls : dir "`sourcedir'" files "*.zip" cd "`unzipdir'" foreach f of local fls { unzipfile "`sourcedir'/`f'", replace } break
Because I would like to keep only the .dbf and .shp files contained in each zip and save them in different folder (i.e. "H:\shapefiles\unzip\2016_RG_01" for the 2016_RG_01.dbf, 2016_RG_01.shp files) is it possible to add another command in the loop to unzip the different zip files in a different folder and erase the files that I do not need?
Thanks
Federica