asked on
ASKER
ASKER
ASKER
ASKER
ASKER
Linux is a UNIX-like open source operating system with hundreds of distinct distributions, including: Fedora, openSUSE, Ubuntu, Debian, Slackware, Gentoo, CentOS, and Arch Linux. Linux is generally associated with web and database servers, but has become popular in many niche industries and applications.
TRUSTED BY
else echo "Wrong directory"
exit
fi
if [ -f $2 ]; then STOP=$2
else echo "Wrong Control File"
exit
fi
for file in $DIR/*
do
if ! grep -q $(basename $file) $STOP; then echo rm $file
else echo cp $file Dir_B
fi
done
Please note that "Dir_B" is hard coded (not passed as an argument because you didn't request this).
Note further that I put "echo" in front of "rm" and "cp" so you can test the outcome.
Remove both "echo" statements for the "real" processing to occur.
The source directory should not contain any subdirectories to avoid error messages.
If there are such subdirs please let me know.
Finally, please note that the script does preliminary checks for existence of the source directory and the control file.