Skip to main content

A tool to index files and recreate directory structures with symlinks.

Project description

recreate

PyPI version License: MIT PyPI downloads

recreate is a tool to automatically recreate a directory from an index by symlinking to files found elsewhere on your system.

Motivating image

recreate is useful for reproducible data science projects where authors somehow never have the time to describe the directory structure for their experiments. With recreate, the authors only have to run a single-line command to create an index for their data directory (a JSON file with paths, file sizes and hashes) and users can recreate the exact file structure without having to move files manually. It is sufficient to specify the directory in which the files can be found.

Installation

pip install recreate

Creating the index

Create index.json from files found in in data/.

recreate --index index.json data/

Using the index

Recreate the file structure defined in index.json by linking files found anywhere in source/.

recreate --recreate index.json source/

You can also specify multiple source directories. This is a common use case for deep learning projects, where multiple datasets (e.g. train/validation/test) may have to be placed at the correct location. The recreate tool makes this easy. You only have to point it to the datasets and it will link the files to the appropriate location.

recreate --recreate index.json dataset1/ dataset2/ dataset3/ # and so on...

Or let recreate search through the current directory.

recreate --recreate index.json .

For more options, see recreate --help

How does recreate work?

For indexing, recreate runs through all given directories in parallel and hashes all files (except those starting with .) with SHA-256.

For recreating, files in the given directory are again hashed in parallel and compared to the index. If there is a match, the file is linked to where it is supposed to be according to the index.

To accelerate matching, files which have the same name as a file in the index are hashed first, since they are more likely to have a matching SHA-256 hash. Files with file sizes that do not occur in the index are not hashed, since they can never have a matching SHA-256 hash.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

recreate-0.3.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

recreate-0.3.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file recreate-0.3.0.tar.gz.

File metadata

  • Download URL: recreate-0.3.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for recreate-0.3.0.tar.gz
Algorithm Hash digest
SHA256 a26a047473c0e4817f802ecd65c1fb62d5e331d74f5852fa59cc872863559ef6
MD5 313fb40959a7fdf72439f1be8c1286f5
BLAKE2b-256 8b27f0fba7ed074514dadc54e1e25c0bea66f98d9872f841fe5e9e0e09d86d2f

See more details on using hashes here.

File details

Details for the file recreate-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: recreate-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for recreate-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 947ce63788a91c872a22218f7d20ce70abe10168f58215139a88e87b5e6c085e
MD5 d28f53f0e83589b8ddf99e0e6aa6956a
BLAKE2b-256 7bb39dd72fe2daa92f952ee26bd7778e6101c40b631b4b690025daa94a549259

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page