This project consists of a pair of Bash scripts designed to help maintain consistent folder structures across different devices when moving projects. This is particularly useful for developers and professionals who frequently transition between working on portable devices and desktop environments, ensuring that project directories remain organized and identical across all devices.
Maintaining identical folder structures for projects across multiple devices can be a challenging task, especially when transitioning work between portable devices and desktops. This becomes a problem specifically when your device from scratch again. This script aims to streamline this process by automating the synchronization of git repository-based project folders.
The solution is divided into two main scripts:
-
Export Script: This script searches for
.git
directories within a given folder hierarchy, extracts the URLs of their remote origins, and saves them along with their paths to a CSV file. This effectively creates a snapshot of your project directories and their associated git repositories. -
Import Script: This script reads the previously generated CSV file and reconstructs the directory structure on a different device by cloning the repositories from their saved URLs into their corresponding paths.
- No installation is required, but you must have
git
andbash
installed on your device. These scripts should work on any Unix-like operating system, including Linux and macOS. - Assumptions: You've already set up SSH keys and have access to the repo you want to pull.
- Navigate to the root directory from which you want to start the export.
- Run the export script:
This generates a file named
bash indexGenerator.bash
git_repos.csv
in the current directory, containing the paths and git URLs of your projects.
- Copy the
git_repos.csv
file to the root directory on the new device where you want to import the folder structure. - Run the import script:
The script will recreate the directory structure and clone the git repositories accordingly.
bash indexPuller.bash
- Easy synchronization of project folder structures across devices.
- Automation of tedious manual folder and repository setup.
- Ensures a seamless transition between working environments.
- You can back up the bash files and the generated csv document by
indexGenerator.bash
in any cloud storage of your choice. - Edit either bash file yourself, incase you'd like to extend the features yourself.
Contributions are welcome! If you have suggestions for improvements or bug fixes feel free to make changes.
This software is provided "as is," without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
Use of this script is at your own risk. While it has been designed with care and with the intention of being useful, the responsibility for ensuring its proper function and for safeguarding data lies with the user. It's recommended to always have backups of important data and to review scripts before execution to ensure they meet your needs and security standards.