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

Popular posts from this blog

apache - setting document root in antoher partition on ubuntu -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -

Process 'command 'F:\android-sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1 -