SD Copy copies files from a source directory to a destination directory, preserving the directory structure and file timestamps. It can be used for organizing destination files by date (see Placeholders below)
-
Clone the repository:
git clone https://github.com/yourusername/sdcopy.git cd sdcopy
-
Build the project:
go build -o sdcopy main.go
Run the sdcopy
command with the source and destination paths as arguments:
./sdcopy /path/to/source /path/to/destination
This will copy all files from /path/to/source to /path/to/destination, preserving the directory structure and file timestamps.
You can use placeholders in the destination path to dynamically create directories based on the file's modification time. The following placeholders are supported:
- {year}: The year of the file's modification time (e.g., 2023)
- {month}: The month of the file's modification time (e.g., 01)
- {day}: The day of the file's modification time (e.g., 15)
For example:
./sdcopy /path/to/source /path/to/destination/{year}/{month}/{day}
If a file was modified on Jan 15, 2023, it will be copied to:
/path/to/destination/2023/01/15/filename