Linux removing folders older than 1 year and more than 3 files

ANT selectors enable you to customize the fileset to delete. Try the following: <target name=”purge”> <tstamp> <format property=”touch.time” pattern=”MM/dd/yyyy hh:mm aa” offset=”-300″ unit=”day”/> </tstamp> <delete> <fileset dir=”${src.dir}”> <date datetime=”${touch.time}” when=”before”/> <scriptselector language=”javascript”><![CDATA[ if (file.getParentFile().list().length > 3) { self.setSelected(true); } else { self.setSelected(false); } ]]> </scriptselector> </fileset> </delete> </target>

Creating a ZIP archive from a Cocoa application

As of iOS8/OSX10.10 there is a built-in way to create zip archives using NSFileCoordinatorReadingOptions.ForUploading. A simple example of create zip archives without any non-Cocoa dependencies: public extension NSURL { /// Creates a zip archive of the file/folder represented by this URL and returns a references to the zipped file /// /// – parameter dest: the … Read more

Python in-memory zip library

According to the Python docs: class zipfile.ZipFile(file[, mode[, compression[, allowZip64]]]) Open a ZIP file, where file can be either a path to a file (a string) or a file-like object. So, to open the file in memory, just create a file-like object (perhaps using BytesIO). file_like_object = io.BytesIO(my_zip_data) zipfile_ob = zipfile.ZipFile(file_like_object)

Unpack inner zips in zip with Maven

You can unzip any files using ant task runner plugin: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.6</version> <executions> <execution> <id>prepare</id> <phase>validate</phase> <configuration> <tasks> <echo message=”prepare phase” /> <unzip src=”https://stackoverflow.com/questions/3264064/zips/archive.zip” dest=”output/” /> <unzip src=”output/inner.zip” dest=”output/” /> <unzip dest=”output”> <fileset dir=”archives”> <include name=”prefix*.zip” /> </fileset> </unzip> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin>