This project provides a utility for sharing and receiving directories via a command-line interface. It uses a Git-based approach to facilitate easy file transfers between users. The workflow includes building the project using make, running the ./share program, and following prompts to either share or receive files.
- Share directories with specific users or branches.
- Receive directories to a specified location.
- User-friendly prompts for seamless interaction.
- Uses Git repositories for version control and file management.
- Git: Ensure Git is installed on your system.
- C++ Compiler: The project requires
g++or any C++17-compatible compiler. - GitHub Personal Access Token (PAT):
- A GitHub PAT is required for authentication when accessing the
git-repo. - Contact divik.chotani@gmail.com for a PAT to use this repo, alternatively, you could generate your own PAT and then modifyline 329 of main.cpp and line 55 of receive.cpp to use your own repo
- A GitHub PAT is required for authentication when accessing the
Run the following command in the root of the project directory to compile the binaries:
make all
# File Sharing Program
## 1. Personal Access Token (PAT) Requirement
Before running the program, ensure you have a valid GitHub Personal Access Token (PAT). This token is required to authenticate with the git-repo.
### Steps to Generate a PAT:
1. Log in to your GitHub account.
2. Navigate to **Settings > Developer Settings > Personal Access Tokens**.
3. Generate a new token with the following scopes:
- `repo` (for accessing repositories).
4. Copy the generated token and keep it secure.
5. Export the PAT as an environment variable so the program can use it:
```bash
export GITHUB_PAT=your_personal_access_tokenEnsure you're in the correct directory where the compiled programs (share-file and receive) and the Git repository (git-repo) are located.
Execute the ./share script to initiate sharing or receiving files.
Run the following command:
./shareYou will see the following prompts:
Enter 'share' or 'receive': receive
Enter the path where you want to receive the directory: ~
Enter a temporary receiver name: sigma
- Prompt 1: Choose whether to share or receive. Type
receiveto receive files. - Prompt 2: Enter the directory where the received files should be saved (e.g.,
~for your home directory). - Prompt 3: Provide a temporary receiver name (e.g.,
sigma).
The program will then execute the logic for receiving files.
Run the same command:
./shareFollow the prompts:
Enter 'share' or 'receive': share
Enter the directory to share: /path/to/share
Enter who you want to share it to: recipient-branch
- Prompt 1: Choose
shareto share files. - Prompt 2: Provide the path of the directory you want to share.
- Prompt 3: Enter the name of the recipient branch or user.
The program will handle sharing the specified directory.
To remove the compiled binaries and reset the project, run:
make cleanThe directory structure is as follows:
file-share/
│
├── main.cpp # Code for the 'share-file' program
├── receive.cpp # Code for the 'receive' program
├── makefile # Build configuration
├── setup.sh # Script to install binaries
├── .gitignore # Excludes unnecessary files from Git
├── git-repo/ # Git repository for sharing/receiving files
└── README.md # Documentation
- Ensure the
git-repodirectory is initialized as a valid Git repository.- The
makefileincludes a target (init-git-repo) to handle initialization.
- The
- Add
.DS_Storeand.vscodeto.gitignoreto exclude unnecessary files from the repository. - Customize the
makefileorsetup.shscript to adjust the installation directory or other configurations.
- Ensure the
git-repodirectory exists and is initialized withgit init.
- Verify the binaries are correctly built using
make alland are located in the project directory.
Feel free to contribute to this project or raise issues via GitHub!