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"' \;
find: Thefindcommand 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": Replacesource_extensionwith the specific extension of the files you want to gather. For example, if you want to find all files with the.sasextension, 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 variablepathand constructs the destination directorydbased on the relative path from the root folder to the file. Then, it creates the necessary directories usingmkdir -pand copies the file to the temporary directory usingcp.
Usage¶
To gather your sources using the provided command, follow these steps:
- Open a terminal on your Linux system.
- Replace
path/to/root/folder/with/source/filesin the command with the actual path to the root folder containing your source files. - Replace
.source_extensionin the command with the specific extension of the source files you want to gather. - Replace
/path/to/temporary/dir/for/sources/in the command with the actual path to save gathered sources. - Copy the modified command and paste it into the terminal.
- 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.