LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   seeking tool to help with file download placement (https://www.linuxquestions.org/questions/linux-desktop-74/seeking-tool-to-help-with-file-download-placement-4175468055/)

SaintDanBert 07-01-2013 03:52 PM

seeking tool to help with file download placement
 
I go to the web looking for all sorts of information. Yes, I also look for music and images and videos. I'm looking for some sort of utility or browser extension that will help me sort out all of these downloads.

The tool might work like this:
  1. I request a download of some file, say mumble.pdf
  2. The mime type, coupled with the file extension, tell the utility what sort of file I'm grabbing.
  3. While I sometimes get the options to SaveHere when I request a download, usually the files end up in the default download folder.
  4. Instead, I'd like to tool to see that I'm grabbing a PDF, and download into my designated book-reader shelf folder.

Someone suggested that I run a daemon process to watch the default download folder, notice there are new contents, then move those contents to where they belong. I tried a 'cron job' but there was so much delay waiting for things to move. I don't want some process polling the download folder. Perhaps if there is some way to learn that files were written into a folder and start the crank then.

Thanks in advance,
~~~ 8d;-/ Dan

druuna 07-02-2013 03:44 AM

Although it might be possible to do so I do think your described approach makes it harder then expected/needed. One of the first problems that comes to mind; If this tools runs on a regular base, it needs to make sure that the downloads are finished before moving them to a specific destination.

Why not simplify things and create a (shell) script that can do this job for you and run it whenever you feel like it and the system isn't downloading.

This approach will also make sure that it isn't paired with a specific program (browser, (s)ftp, scp, wget, etc...), it will look in one (or more) specified directories.

You might go as far as to run this script at boot.

Just my 2c.

eSelix 07-02-2013 04:14 AM

For Firefox you can use Download Sort extension. But external script, like druuna said, would be better - it not works only with Firefox. This approach has advantage when you want to skip moving big files between partitions.

David the H. 07-03-2013 01:14 PM

I think a script that you could call on to "open" the download files directly from the browser, instead of the default mime-type option, would be even better.

I'm not completely sure about how to go about this at the moment, but I believe that browsers generally just save the file to /tmp or someplace similar, and pass that file location on to the program. So the script would probably just need to read the filename, analyze its type, and move it to the proper preset location.

SaintDanBert 07-03-2013 03:43 PM

Quote:

Originally Posted by David the H. (Post 4983601)
I think a script that you could call on to "open" the download files directly from the browser, instead of the default mime-type option, would be even better.

Agreed that a browser extension (or "plug-in" or "add-on" or whatever) makes a lot of sense. Primarily because most download activities are a direct result of browser activities. If I'm doing something else, 'wget' or similar already lets me steer the placement of the fetched file artifacts.

Quote:

Originally Posted by David the H. (Post 4983601)
I'm not completely sure about how to go about this at the moment, but I believe that browsers generally just save the file to /tmp or someplace similar, and pass that file location on to the program.

Every browser that I work with, including Android based browsers, have configuration of a default download folder. I've not discovered the why or how, but on occasion, I get a dialog that asks "where to save" the file artifacts during the download. I don't recall doing anything unusual to provoke this dialog or else I would use it routinely.

Quote:

Originally Posted by David the H. (Post 4983601)
So the script would probably just need to read the filename, analyze its type, and move it to the proper preset location.

I started a parallel thread Seeking Help With Script Writing to discuss the coding in detail. In short, there are two parts to a solution
  1. scan the download folder and move files to their destination
  2. discover when there is work to do and launch the scan
Please join us over there.

Cordialement,
~~~ 0;-Dan


All times are GMT -5. The time now is 01:19 AM.