Thursday, 29 August 2019

Copying file from One directory to Another in Unix

copy_file{
for file in \MyDrive\MyFolder\
  do
  echo $file
  FILESIZE=$(stat -c%s $file)
  echo "filesize " $FILESIZE
    if [[ "$FILESIZE" -eq 0 ]]
        then
           echo "$file is empty.Hence not sending it.Can't Execute further"
          exit 1
        else
         echo "$FILE has data."
    fi
  echo "Copying File "
  cp  $file $Other_Directory
}

#************Starting Copy File String#

copy_file

No comments:

Post a Comment