1

I need help for a script that can auto move an .mp4 files after a completed download. Lets say that I download a folder that contains 3 files and I only want to move the .mp4 file to a specific folder after the download and then delete the folder and the leftovers again.

Is that possible to do? I can get an normal mv command to work. But I can seams to find out how to launch the script so it only take the finish files?

I want to move from from etc. /home/downloads to /Home/uploads.

Hope someone can help me crack this :)

Best regards

2 Answers 2

0

Write a simple bash script like cd ~/Downloads mv *.mp3 ~/Uploads/.

This script will move all files with a .mp3 extension from the current folder to the specified folder. You could put it in a file like movemp3.sh and then run it when you downloaded stuff.

If using Deluge see http://dev.deluge-torrent.org/wiki/Plugins/Execute page for a simple plugin that will allow you to execute scripts on common events. Specifically look at the Event labeled "Torrent Complete". This should give you the functionality you look for. Note that you will have to do a similar search and find relevant plugins for other programs.

8
  • You can do anything to do it automatic after a download is finish?
    – Extati
    Commented Jun 16, 2017 at 16:47
  • Not sure of any easy way to do it immediately after a download, but you could easily add it to cron and run it periodically throughout the day. I'm sure it's possible to do it only after download, but you'll have to do some research to figure out how to monitor when a download occurs/finishes. Commented Jun 16, 2017 at 16:50
  • Yea, it there I have my problem. Good idea with the cronjob tho. Thanks
    – Extati
    Commented Jun 16, 2017 at 17:00
  • If you are looking for an answer to the download thing you need to provide more information as to how you are doing your download. If you are using something like wget it's really easy to accomplish what you want. However, the answer is dependent upon how you are doing this. Please provide more info if you would like an answer. Commented Jun 16, 2017 at 17:12
  • Often the files is download with Deluge or rutorrent !
    – Extati
    Commented Jun 16, 2017 at 17:16
0

Since you mentioned Deluge you could set deluge to move completed downloads to a directory say /CompletedDownloads. You can set up rTorrent to move them to the same directory. Then you could setup a cron job to check that folder periodically and then run the two lines @brian-sizemore suggested.

cd ~/CompletedDownloads
mv *.mp4 ~/Uploads/.

This way when files are moved you are certain they are fully downloaded.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .