საიტის გასაუმჯობესებელი სამუშაოების მიმდინარეობისას, შესაძლებლობების ნაწილი შეიზღუდება. თუ სტატიით ვერ მოახერხებ ხარვეზის გამოსწორება და შეკითხვის დასმა გსურთ, ჩვენი მხარდაჭერის გუნდი დაგეხმარებათ @FirefoxSupport გვერდის მეშვეობით Twitter-ზე და /r/firefox განყოფილებაში Reddit-ზე.

ძიება მხარდაჭერაში

ნუ გაებმებით თაღლითების მახეში მხარდაჭერის საიტზე. აქ არასდროს მოგთხოვენ სატელეფონო ნომერზე დარეკვას, შეტყობინების გამოგზავნას ან პირადი მონაცემების გაზიარებას. გთხოვთ, გვაცნობოთ რამე საეჭვოს შემჩნევისას „დარღვევაზე მოხსენების“ მეშვეობით.

ვრცლად

How do you format the download destination path?

  • 2 პასუხი
  • 1 მომხმარებელი წააწყდა მსგავს სიძნელეს
  • 16 ნახვა
  • ბოლოს გამოეხმაურა jscher2000 - Support Volunteer

Say, for example, I want the download path to be "MyDownloadDirectory/%yyyy/%yyyy.%mm" which means "Change the download path every month to a folder named after the current year and the current month inside a folder named after the current year".

Many non-browser applications allow me to do this, but for some reason browsers generally don't have that option. I was thinking that there was a way to do this in Firefox.

What is a way to do this? If it's not possible in vanilla Firefox, is there an extension available for this?

Say, for example, I want the download path to be "MyDownloadDirectory/%yyyy/%yyyy.%mm" which means "Change the download path every month to a folder named after the current year and the current month inside a folder named after the current year". Many non-browser applications allow me to do this, but for some reason browsers generally don't have that option. I was thinking that there was a way to do this in Firefox. What is a way to do this? If it's not possible in vanilla Firefox, is there an extension available for this?

ყველა პასუხი (2)

There are several prefs related to downloads.

This should be possible via the autoconfig.cfg file in the Firefox installation folder as you can run privileged JavaScript code via this file. See also:

You can give this a try as Firefox might be stubborn and wants to use the default download location.

To use Autoconfig, place two files into the Firefox installation directory.

  • on Windows, they go into the same directory where Firefox is installed
  • on macOS, they go into the Contents/Resources directory of the Firefox.app

The autoconfig.js file that specifies to use autoconfig.cfg is placed into the "defaults\pref" directory where the channel-prefs.js file is located.

//
pref("general.config.filename", "autoconfig.cfg");
pref("general.config.obscure_value", 0);
pref("general.config.sandbox_enabled", false); // disable sandbox

The autoconfig.cfg file is placed at the top level of the Firefox directory.

  • autoconfig.cfg and autoconfig.js need to start with a comment line (//)
  • autoconfig.js needs to use Unix line endings (LF instead of CR/LF)

Content of autoconfig.cfg in the Firefox installation folder.

//  autoconfig.cfg needs to start with a comment line
try{
let Services = globalThis.Services || ChromeUtils.import("resource://gre/modules/Services.jsm").Services;
let month = ((new Date).getMonth()+1).toString().replace(/^(\d{1})$/, "0$1");
let year = (new Date).getFullYear();
let path = Services.dirsvc.get("DfltDwnld", Ci.nsIFile).path; // you can replace this with another path
path += "/"+year+"/"+year+"."+month; // /%yyyy/%yyyy.%mm

Services.prefs.setCharPref("browser.download.dir", path);
Services.prefs.setCharPref("browser.download.lastDir", path);
Services.prefs.setIntPref("browser.download.folderList", 2);
} catch(e){Components.utils.reportError(e);}

Note that any error in autoconfig.cfg throws an error and abort processing this file.

ჩასწორების თარიღი: , ავტორი: cor-el

Since you only need to change it monthly, perhaps it's simplest to set it up manually on the Settings page every month. If you need to include other factors such as the source site, or prefix/suffix the file name, an add-on probably is most logical. Note that for security reasons, add-ons are restricted to paths under your Downloads folder (or is it the system Downloads folder? I can't remember.).