Skip to content

Preparing folder structure

Alchemist works best when all of the sources are organized in the original folder structure. This documentation page will walk you through the process of gathering sources.

Talk to your IT for help on how to run the following commands on your system environment.

Linux

On Linux, you can use a command similar to this:

find path/to/root/folder/with/source/files -type f -name "*.source_extension" -exec bash -c 'path="{}"; d=/path/to/temporary/dir/for/sources/$(dirname "${path#path/to/root/folder/with/source/files}"); mkdir -p "$d" ; cp "$path" "$d"' \;
Let's break down the components of this command:

  • find: The find command is used to search for files and directories based on various criteria.
  • path/to/root/folder/with/source/files: Replace this with the actual path to the root folder where your source files are located.
  • -type f: This option specifies that we want to find only files, not directories.
  • -name "*.source_extension": Replace source_extension with the specific extension of the files you want to gather. For example, if you want to find all files with the .sas extension, replace it with "*.sas".
  • -exec bash -c 'path="{}"; d=/path/to/temporary/dir/for/sources/$(dirname "${path#path/to/root/folder/with/source/files}"); mkdir -p "$d" ; cp "$path" "$d"' \;: This is the command executed for each matched file. It assigns the path of the file to the variable path and constructs the destination directory d based on the relative path from the root folder to the file. Then, it creates the necessary directories using mkdir -p and copies the file to the temporary directory using cp.

Usage

To gather your sources using the provided command, follow these steps:

  1. Open a terminal on your Linux system.
  2. Replace path/to/root/folder/with/source/files in the command with the actual path to the root folder containing your source files.
  3. Replace .source_extension in the command with the specific extension of the source files you want to gather.
  4. Replace /path/to/temporary/dir/for/sources/ in the command with the actual path to save gathered sources.
  5. Copy the modified command and paste it into the terminal.
  6. Press Enter to execute the command.

The command will search for all files with the specified extension in the given root folder and copy them to a temporary directory, preserving the directory structure.