Results 1 to 2 of 2

Thread: Move Files Script

  1. #1
    Join Date
    Jan 2012

    Question Move Files Script

    Hey Guys!

    I'm new here and I have a problem.

    I have DropBox installed on my Ubuntu machine and my iPad. When I'm out of the house I usually upload things from my iPad to my DropBox and my DropBox from Ubuntu automatically downloads the files.

    Because I have the basic 2GB DropBox account and it's almost full, I need a script that would check every X seconds if the DropBox folder (default /home/myuser/Dropbox) has files, and if it has, to move all the files to a Y folder and delete those from the DropBox folder.

    I don't want to filter any files.
    I want it simple. If there are files in the Dropbox folder, move all of them to another folder and delete them from the Dropbox folder.

    Any piece of code? Any chance that someone could teach me how to set that bash script to run at startup of the machine?


  2. #2
    Join Date
    Jan 2012

    Re: Move Files Script

    I've tried a lots of things and I created this code myself at the end:

    if [ "$(ls $Dropbox)" ]; then
         echo "Found files in $Dropbox!"
         echo "Moving..."
         cd $Dropbox
         mv * $Directory
         echo "Everything done!"
        echo "$Dropbox is Empty!"
        echo "Nothing to move."
    This will check the "Dropbox" folder for files. If there are any, they will be copied to "Directory".

    Now I'm searching for a way to make this run every 15 minutes...

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