Skip to main content

export - How to create TAR archive without top-level folder?


Mathematica has the handy CreateArchive function, which allows you to efficiently create a TAR archive from a directory. However, I see no way of specifying not to include the directory itself, so that the files in it are included directly in the top-level of the TAR.


Note that:





  • I am looking for a cross-platform solution (i.e. running a command on the underlying OS is not an option).




  • I am dealing with large files, so I am looking for fast low-level copying (i.e. importing the files and then exporting them again would work, but very slowly).




  • I understand having all the files in the top-level directory is not the best practice, but this needs to be the case for compatibility purposes (i.e. to comply with a file-format specification).





Any ideas or suggestions?


Thanks!




Comments