Results 1 to 2 of 2

Thread: Zenuty --confirm-overwrite

  1. #1
    Join Date
    Oct 2009
    Beans
    4

    Zenity --confirm-overwrite

    Hi not sure if this is really the right place for this but here goes...
    How can I make this:

    Code:
    #!/bin/bash
    #Move multiple files
    moveThis=`echo $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS`
    toHere=`zenity --multiple --file-selection --directory`
    mv $moveThis $toHere
    so that it will not over-write a file if it is there ( I am new to this as you can probably tell)
    I tried
    Code:
    toHere=`zenity --multiple --file-selection --save --confirm-overwrite --directory'
    using all sorts of scenarios.. meaning moving the --save and --confirm-overwrite in different positions what happens is I do get the dialog and it will not move nothing when I click ok (the dialog still stays) however when I click cancel it will move one of the 2 files, I tried it with 3 files, 2 that were in the spot I was moving to and one not, when I click ok nothing, then when click cancel nothing. Any help or pointing me in a direction that might be able give me help will be appriciated, thanks!
    Last edited by rhalaquist; October 21st, 2009 at 11:29 PM. Reason: Spelling in title and tags :( - so much for title changing

  2. #2
    Join Date
    Feb 2007
    Beans
    4,045
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Zenity --confirm-overwrite

    I believe the --confirm-overwrite option only makes sense when selecting files, not directories. Instead you could check whether the directory is empty or not in bash, and use a zenity --question if it's not empty.

    How to check if a directory is empty or not is explained here http://mywiki.wooledge.org/BashFAQ/004

    Also, remember to "quote" pattern expansions.
    Code:
    mv "$moveThis" "$toHere"
    Without quotes, you'll get undesired results if either of the variables contains path names with spaces. This has an explanation of why http://bash-hackers.org/wiki/doku.php/syntax/words

Tags for this Thread

Bookmarks

Posting Permissions

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