shell - How to copy files with a particular extension from one directory to another in linux -
i newbie in linux. have write shell script accepts user input ("file extension" , "destination") , copy files 1 directory destination directory.
how that?
try this:
myscript.sh
#/bin/sh ext=${1} dst=${2} cp *.$ext "$dst"
ex:
$ myscript.sh cpp /home/user/
copies files .cpp extension in current directory /home/user directory
Comments
Post a Comment