1
Someone can fix my script?
The purpose of the script is to compare the input files with the files in the folder JUNK, the problem is that if the input file is teste1.txt
he cannot find the file teste1.tar.bz2
#!/bin/bash
##CONSTANTES##
dir="/home/pasta/LIXO"
#check para ver se é file#
if ! [ -e $1 ]; then
echo "Not a file!"
exit 0
fi
###main###
#ciclo for para aceitar multiplas entradas de ficheiros##
for file in "$@"; do
#se o ficheiro de entrada existir no diretorio /LIXO#
if [[ -f $dir/$file ]]; then
echo "|||File EXISTS|||"
#se o file de entrada for mais novo do que o file que lá está#
if [[ $file -nt $2 ]]; then
echo "file is newer"
fi
else
echo "File doesnt exist, ziping it and moving"
fi
done
#to:do
#add tar / mv /rm
#eventualmente adicionar os comandos para fazer Zip do ficheiro e mover.
teste1.txt
is the same thing asteste1.tr.bz2
, thus the main objective is to compare"teste1" == "teste1"
correct? Or still need to compress the file and move it?– Don't Panic
at this moment yes! I will eventually add the commands to do Tar and move the file, the problem is that it does not find the zipped file!
– storms