Good day I have the next task I need to copy files from a camera to an HDD both connected on the same computer I plan to make automatic backups when I enter the camera and synchronize them to the HDD that I have connected to the computer.
Searching the internet I found that rsync solves the part of the synchrony, on the other hand I do not know how to ask for the microSD its capacity is 32gb and its format is fat32.
I found a small script that says the following
#!/bin/bash
#
# -*- ENCODING: UTF-8 -*-
# Este programa es software libre. Puede redistribuirlo y/o
# modificarlo bajo los términos de la Licencia Pública General
# de GNU según es publicada por la Free Software Foundation,
# bien de la versión 2 de dicha Licencia o bien (según su
# elección) de cualquier versión posterior.
#
# Si usted hace alguna modificación en esta aplicación,
# deberá siempre mencionar al autor original de la misma.
#
# Copyleft 2012, DesdeLinux.net {Ciudad Habana, Cuba}.
# Autor: KZKG^Gaara <[email protected]> <http://desdelinux.net>
CONTROL=0
PLACE="/home/media/pi/toshiba"
mkdir $PLACE
chmod 777 -R $PLACE
while [ $CONTROL=0 ] ; do
cat /etc/mtab | grep media >> /dev/null
if [ $? -ne 0 ]; then
CONTROL=0
else
CONTROL=1
for USBDEV in 'df | grep media | awk -F / {'print $5'}' ;
do
USBSIZE='df | grep $USBDEV | awk {'print $2'}'
if [ $USBSIZE -lt 15664800 ]; then
USBNAME='echo $USBDEV | awk -F / {'print $3'}'
mkdir $PLACE/$USBNAME
rsync /media/$USBNAME/ $PLACE/$USBNAME/ -ahv --include-from=/opt/bash/usb-spy.files --exclude=*.* --prune-empty-dirs
fi
done
fi
sleep 5
done
exit 0
Copy the files perfectly but copy them to the local hdd (where the boot files are loaded, the home and those things), the problem is that when I enter the backup HDD when executing it from the terminal I get a message with the following "too many arguments" legend
Now I kept thinking and I understand that the IF cycles are to condition the next action what I do not give is like asking specifically for my microSD because I understand that it does not know what device to synchronize, I hope you can help me