Skip to content

Instantly share code, notes, and snippets.

@Cellane
Created December 2, 2010 16:11
Show Gist options
  • Save Cellane/725586 to your computer and use it in GitHub Desktop.
Save Cellane/725586 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
echo -n "Zdrojový adresář: "
read zdroj
echo -n "Cílová cesta: "
read cil
echo -n "Stáří (ve formátu AwBdChDmEs): "
read datum
if [ -d $zdroj ]; then
if [ ! -d $cil ]; then
echo "Vytvářím adresář se zálohou!"
mkdir $cil
fi
echo "Vytvářím adresářovou strukturu!"
find $zdroj -type d -exec mkdir $cil/'{}' ';' 2>/dev/null
echo "Kopíruji soubory!"
find $zdroj -type f -atime $datum -exec cp '{}' $cil/'{}' ';' 2>/dev/null
echo "Hotovo!"
else
echo "Neplatná cesta!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment