Results 1 to 4 of 4

Thread: bash script if file exists statement not wroking

Threaded View

  1. #1
    Join Date
    Jun 2008

    [SOLVED]bash script if file exists statement not wroking

    im working on some bash scripts that run on logon/off and backup the resume data for uTorrent so that it automatically copies the resume data to the other OS i boot into and resumes the torrents where i left off ( i have a quad boot ). im currently working on the Ubuntu on/off scripts. i have Ubuntu 12.04.

    the problem is that i cant get the if file exists part to work:
    if [ -f "/opt/utorrent-server-v3_0/resume.dat" ];
    i know "/opt/utorrent-server-v3_0/resume.dat" exists as i get command not found in terminal. It always goes to the else, so im pretty sure something is wrong with the file exists part. what do you guys think?


    if [ -f "/opt/utorrent-server-v3_0/resume.dat" ]; #if it exists 
    		#copy currrent resume to the Data partition
    		cp "/opt/utorrent-server-v3_0/resume.dat" "/media/Data/uTorrentBack" 
    		cp "/opt/utorrent-server-v3_0/resume.dat.old" "/media/Data/uTorrentBack"
    		#copy all .torrent files to the Data partition
    		cp "/opt/utorrent-server-v3_0/"*.torrent "/media/Data/uTorrentBack"
    		zenity --info --text="uTorrent resume files not found! \n uTorrent not installed?" #make a pop-up alert!
    PS: i couldn't post in the dev + program forum below, sorry
    Last edited by sirbow2; December 13th, 2012 at 11:29 PM.

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts