The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 02-11-2009
handband2 handband2 is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 5
If doc file exist remove

I need help running a script. I have the script looking into a folder and converting .doc files to .odt. The script works fine except that I want it to only run when .doc files are present. If I can do this then I can put .xls files and .ppt files in the folder and convert them when they are detected.

This is what I currently have:

Code:
#! /bin/bash
for file in *.doc
    do
    if [ -e "*.doc" ]
        then
        mkdir ./ODT
        python /opt/DocumentConverter/DocumentConverter.py "${file}" "${file}".odt
        for i in *.odt; do j=`echo $i | sed 's/doc.odt/odt/g'`; mv "$i" ./ODT/"$j"; done
    fi   
done

Thanks!