#!/bin/sh -x # Backup and delete files in list file [ $# -lt 1 ] && { echo "INPUT FILE NAME MISSING!"; exit 1; } INPUT_FILE=$1 [ -f $INPUT_FILE ] || { echo "INPUT FILE NOT EXIST"; exit 1; } #Commands mkdir -pv ~/bakup_`date +%F` ## Back up and remove the in list for file in $(cat $INPUT_FILE) do if [ -f $file ] then echo $i; /bin/cp -vR $file ~/backup_`date +%F`/ --parents; /bin/rm -i $file; fi done