Command line tool for file transfer
- Upload: Compress files/directories to tar.gz and upload to server
- Download: Download and automatically extract files from server
curl- for HTTP requeststar- for compression/decompression
The tool will automatically check for dependencies and inform you if anything is missing.
💡 For detailed installation instructions, see INSTALL.md
# Download and install .deb package
wget https://github.com/ga111o/datalink_client/releases/latest/download/dtlk_1.0.3_all.deb
sudo dpkg -i dtlk_1.0.3_all.deb- Clone or download this repository
- Make the script executable:
chmod +x dtlk
- Install system-wide (requires sudo):
make install
During installation, you'll be prompted to configure the server:
- Option 0 (default): Use the default server (https://datalink.ga111o.com)
- Option 1: Enter your custom server URL
Example installation process:
DataLink Client Installation
============================
Server Configuration:
0) Use default server (https://datalink.ga111o.com)
1) Configure custom server URL
Please choose an option [0]: 1
Enter your server URL (e.g., https://your-server.com): https://my-datalink.example.com
Build your own packages:
# Build Debian package
make package-deb
# Build Arch package
make package-arch
# Build all packages
make package-allUpload one or more files or directories:
# Upload a single file
dtlk up myfile.txt
# Upload multiple files
dtlk up file1.txt file2.txt
# Upload directories
dtlk up folder1/ folder2/
# Mixed upload
dtlk up myfile.txt myfolder/ another_file.txtThe tool will:
- Compress all specified files/directories into a tar.gz archive
- Upload to the server
- Display an 8-digit file ID for later download
Download files using the 8-digit ID:
# Download to current directory
dtlk down 12345678
# Download to specific directory
dtlk down 12345678 ./downloads/
# Download to non-existent directory (will be created)
dtlk down 12345678 ./new_folder/The tool will:
- Download the file from the server
- Automatically extract the tar.gz archive
- Handle duplicate files by adding
_dups{number}suffix if files already exist - Clean up temporary files
dtlk --help
dtlk help
dtlk -hWhen downloading files, if a file or directory with the same name already exists in the destination, the tool will automatically rename the downloaded item to avoid conflicts:
- Files:
filename.txt→filename_dups1.txt,filename_dups2.txt, etc. - Directories:
dirname→dirname_dups1,dirname_dups2, etc. - Files without extensions:
filename→filename_dups1,filename_dups2, etc.
The tool will inform you of any renamed files during the download process.
The server URL can be configured during installation using make install. You can choose between:
- Default server:
https://datalink.ga111o.com - Custom server URL of your choice
If you need to change the server URL after installation, you can:
-
Edit the installed script (requires sudo):
sudo nano /usr/local/bin/dtlk
Find and modify the
SERVER_URLvariable. -
Reinstall with different configuration:
make uninstall make install
-
Use local copy with modified URL: Edit the
dtlkscript in your local directory and run it directly:./dtlk up myfile.txt
Run basic functionality tests:
make testCreate test files for development:
make dev-testClean up test files:
make dev-cleanRemove the installed tool:
make uninstallThe tool expects a server with the following endpoints:
-
Upload:
POST /upload- Accepts multipart form data with
filefield - Returns JSON with
idfield containing numeric file ID
- Accepts multipart form data with
-
Download:
GET /download/{id}- Returns the uploaded file
- Should include proper headers for file download
The tool handles various error conditions:
- Missing files/directories
- Server connection issues
- Invalid file IDs
- Failed uploads/downloads
- Missing dependencies
This project is licensed under the MIT License.
Feel free to submit issues and enhancement requests.