In an earlier question I asked, I asked if it was possible to unzip files. I read a blog (Using FILENAME ZIP to unzip and read data files in SAS - The SAS Dummy), but at the moment I am having a hard time following it using JSL.
I have a folder with 150 zipped folders in it. Each folder has a device name, followed by an order score, then the date (ie. Device X_2016_07_20.zip). I want to create a new folder with the device name (which I can get working). I can get open a zip folder and see all the different files within, but I can not figure out how to unzip (or even copy) to the new folder. Can someone please give me a hand?
This is what I have so far:
directory = Pick Directory();
filesInDirectory = Files In Directory( directory );
nFiles = N Items( filesInDirectory ); //get number of zip files in directory
For( i = 1, i <= nFiles, i++,
fileName = filesInDirectory;
pos = Contains( fileName, "_" );
deviceName = Left( fileName, pos - 1 ); //get the device name
subDir = directory || deviceName;
//Create Directory(subDir); //eventually create a new sub directory
za = Open( directory || fileName, zip );
dirlist = za << dir;
Show( dirlist ) // see all contents of zipped folder
;
);