a script to clone a directory but with empty files :P

This is my first seriuous bash script. Thanks in advance to people from #bash and #sed, thanks to Jigen, Dani and Arbiter.

I have a directory with some file inside. I want to create another directory with the same file (with same name) but empty (created with touch).

My code take two parameters:

copianomi.sh -i input_dir -o output_dir

Here my code:

# ./copianomi.sh -i dirInput -o dirOutput

if [ $# -eq "$NO_ARGS" ]  # Script invoked with no command-line args?
   echo "Usage: $0 dirInput dirOutput"
exit        # Exit and explain usage, if no argument(s) given.

# check parameters
while getopts ":o:i:" Option
   case $Option in
      i 	) INPUT=$OPTARG;;
      o	) OUTPUT=$OPTARG;;

# Copy names
for NAME in "$INPUT"/*; do
   touch "$OUTPUT/${NAME##*/}"

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s