Saturday, 8 June 2013

how to match a file extension name in a file

how to match a file extension name in a file

i want to move a file into a directory, example i have file name extlist, its contains
.exe
.lnk
.inf
i try to use script like this
#!/bin/sh
a=`cat /home/harits/extlist`

for f in $(find -type f -name "*.$a")
do
if [[ (this is difficult part) == $f]]
then mv $f
else
echo "fail"
fi
done
and i want to move that file while it have same extension in extlist
sorry for my creepy english.., please guide me here..

No comments:

Post a Comment