# Welcome to gfast-copy’s documentation!¶

## gfast-copy¶

program: gfast-copy (a graphical fast chunk file copy program.) Eddie Brüggemann C 1.0 Oct 19, 2017

### Introduction¶

gfast-copy stands for Graphical Fast Copy and it is build on a very fast copying algorithm.

Note

This tool is implemented into the UNIX spirit:

A single program which can do an unique task but do it well.

It copy a single file to a destination in a practice way.

As fast as it can !!!

gfast-copy only provides a graphical interface for the fast-copy command-line tool,

that I have implement. Which can copy a file like a film (Around 700 Mo) in few seconds.

Note

I have implement it because I often copy videos from a location to another:

Per example from the folder named ToWatch to the folder Seen.

Or *.iso images from the folder Download to the folder ISO_Collection.

Because the O.S can be slow by chunk copy operations.

### Graphical User Interface description¶

#### Interface¶

You get to verticaly align buttons:

1. Source
2. Destination

Use the Source labeled button to set the file to copy Source (Ctrl + S).

This will display the basename of the file to copy onto the button.

Use the Destination labeled button to set the file destination Destination (Ctrl + D).

This will display the basename you have choose for the destination file.

And at they are 2 icons buttons:

• Remove source file toggle button (Ctrl + R).
• Run copying (Ctrl + Return).
note: Take a look at my self-builded GtkSmartIconButton widgets.

Once the copying done, the button contains their original string and icons.

### NOTE¶

I have implement this tool for my personal requirement: good by Hollywood !

So if you think your system is too slow by copying chunk (big) files use (g)fast-copy !

### Credits¶

Thanks to my beloved mother, my family and the doctors.

#### Windows *.exe file¶

Thanks to the gnome-bugzilla team which help to provide you a version of (g)fast-copy.

Without their help only the MSYS2 and Cygwin users would be able to launch (g)fast-copy.

gfast-copy an easy to use graphical fast copy tool for big files.

This file is part of gfast-copy.
gfast-copy is free software: you can redistribute it and/or modify
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

gfast-copy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with gfast-copy. If not, see <http://www.gnu.org/licenses/>


## fast-copy¶

program: fast-copy (a fast chunk file copy program). Eddie Brüggemann C 1.0 Oct 19, 2017

### fast-copy command-line tool¶

fast-copy is a command-line tool which can work in 2 different fashions:

• Using syscall’s.
• Using a FILE streams pointer.
note: Per default it make usage of the file streams.

fast-copy determine the best buffer size and then process displaying a fancy progress-bar if needed into the terminal.

Fast copy takes at least 2 argument the source and the destination to copy the file on GNU/Linux and MacOSX.

windows: The command-line tool is available under Windows using only the file streams and no progress-bar feature is provided.

### Options¶

$fast-copy -h fast-copy - a fast chunk file copy program. Usage : fast-copy -r input-file -w output-file [-o] [-e] [-s] [-h] -r Read from file (required). -w Write to file (required). -o Overwrite destination file (optional). -e Erase source file (optional). -s Use syscalls instead of streams (optional only UNIX). -h Print this help message. - Copyright (©) 2017 Brüggemann Eddie <mrcyberfighter@gmail.com> GPLv3.$


-r

-r (read from file) –> Input file (required).

-w

-w (write to file) –> Output file (required).

-o

-o (overwrite) –> Overwrite destination file (optional).

-e

-e (erase) –> Erase source file (optional).

-s

-s (syscalls) –> Use syscall instead of streams (optional only UNIX).

-h

-h (help) -> Print help message.

The default behavior is to copy source to destination file using file stream, which you can change using the -s switch on UNIX systems.

If the destination file exists fast-copy will ask interactively what to do: overwrite or not the file.

The progress bar is only displayed for files greater than : sizeof_file > (blocksize * 8 * 16 * 16)

This value mean to be 16 Mio using syscalls or using file streams on my system.

note: The blocksize is computed to get the best buffer size: the number of bytes by the copying operation an,d is system dependent.

Finally fast-copy will synchronize the file system.

You can inhibit the interactive overwriting questioning by using th -o > (overwrite) switch.

You can tell program:fast-copy to use syscalls (open, read and write) using the -s –> (syscall) switch.

To know that by every blocksize copy a syscall will be made by handle by the kernel.

Else file streams are buffered operations avoiding calling syscall to often.

You can tell fast-copy to erase the source file once the copy work done using the -e -> (erase) switch.

### How does the algorithm work¶

1. At first it will check for the best buffer size.

Note

• Using file streams: it will look up the BUFSIZ constant if it’s great enough else the program set it to 8192 octets.
• Using syscalls it will look up the the st_blocksize from the stat() function and set it as buffer size.
1. Then it will define a buffer with the optimal size.
2. It will copy the source file to the destination in a loop using the defined buffer.
3. Finally it will synchronize the file-system using fflush() or fsync().

### Wrapper script¶

You can build a wrapper script around the fast-copy command-line tool,

per example using zenity, xclip or like, to get the first argument.

And for the second you need a tool which provides a file-chooser.

As like this one, using zenity and nautilus-action:

#! /bin/bash

###############################################################
# Wrapper for fast-copy using zenity and nautilus-actions for #
# speed up the file copying.                                  #
###############################################################

function usage() {

echo "usage $(basename$0) -r input-file -w output-file [-o] [-s] [-e] [-h]" ;

exit 1 ;
}

if [[ $# -ne 1 ]] ; then # The first argument is given from nautilus-actions. usage ; fi destination=zenity --file-selection --save --confirm-overwrite --filename="$(basename "${1}")" # Here the source file comes from nautilus action i.e # the contextual gnome-desktop add-on nautilus-actions source_filepath=${1}

if [[ -n "${destination}" ]] ; then fast-copy -r "${source_filepath}" -w "\${destination}" -o

zenity --info --text="Copy completed" --no-wrap --no-markup

fi

exit 0