Etsi tuesta

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Lue lisää

How to use a Win/DOS batch file to backup my Firefox bookmarks - yields "file not found"?

  • 14 vastausta
  • 1 henkilöllä on sama ongelma
  • 1 näyttö
  • Viimeisin kirjoittaja Oscar Leckliter

more options

OK - enough space to comm.

I just built a Win 10 system (Pro x64) . In the process I built my standard batch file to backup my data files and Bookmarks to my removable HDD. I used the C:\Users\<your Windows login username>\AppData\Roaming\Mozilla\Firefox\Profiles\ path described in "Profiles - Where Firefox stores your bookmarks, passwords and other user data" article and found a series of files in a sub-folder identified as xbh4bkna.default-release\bookmarkbackups. So the associated line in the batch file reads "xcopy C:\Users\Oscar\AppData\Roaming\Mozilla\Firefox\Profiles\xbh4bk~1\bookma~1\*.* R:\BUs~1\Bookma~1\ /d /s". However, when I execute the batch file I get a "file not found" even through a directory search shows 6 daily files. Any suggestions on how to fix this? Thanks.

OK - enough space to comm. I just built a Win 10 system (Pro x64) . In the process I built my standard batch file to backup my data files and Bookmarks to my removable HDD. I used the C:\Users\<your Windows login username>\AppData\Roaming\Mozilla\Firefox\Profiles\ path described in "Profiles - Where Firefox stores your bookmarks, passwords and other user data" article and found a series of files in a sub-folder identified as xbh4bkna.default-release\bookmarkbackups. So the associated line in the batch file reads "xcopy C:\Users\Oscar\AppData\Roaming\Mozilla\Firefox\Profiles\xbh4bk~1\bookma~1\*.* R:\BUs~1\Bookma~1\ /d /s". However, when I execute the batch file I get a "file not found" even through a directory search shows 6 daily files. Any suggestions on how to fix this? Thanks.

Valittu ratkaisu

I didn't write a batch file, I just ran cmd.exe and used dir. That seems relevant to batch files, but I generally do not write batch files, so I could be wrong about that.

For me, dir requires an "extension" on the profile directory name -- a dot and the first 3 letters of the name of the profile, which is the format shown in the list when using dir with /x.

For example, if your profile is named default or default-release:

dir C:\Users\Oscar\AppData\Roaming\Mozilla\Firefox\Profiles\xbh4bk~1.DEF\bookma~1\*.*

Either way, I think we are in the realm of Windows and not Firefox at this point.

Lue tämä vastaus kontekstissaan 👍 0

Kaikki vastaukset (14)

more options

Does

dir C:\Users\Oscar\AppData\Roaming\Mozilla\Firefox\Profiles\xbh4bk~1\bookma~1\*.*

give you the expected list if you run it in cmd.exe?

more options

Thanks for the suggestion. However that just yields, "The system cannot find the path specified."

more options

What if you back off the path one level at a time, for example, does this part work:

dir C:\Users\Oscar\AppData\Roaming\Mozilla\Firefox\Profiles\xbh4bk~1\

By default, AppData is a hidden folder. You could see whether it helps to set Windows to show hidden files and folder.

https://support.microsoft.com/en-us/help/14201/windows-show-hidden-files

more options

Thanks again. Appreciated. All files are visible - I always set up my systems to show hidden file. That's how I found the noted path. Backing up one level (the dir line your provided) yields "The system cannot find the file specified."

more options

I assume

dir C:\Users\Oscar\AppData\Roaming\Mozilla\Firefox\Profiles

works. The shortened paths must not be exactly what cmd.exe expects.

more options

While that shows the directories, it shows no files. I also appended \*.* and received the same result. Seems very strange to me as, of course, the question might be not recognizing the file formats...but it recognizes docx and xlsx files no problem, and all other typical file formats. Any more thoughts anyone?

more options

As far as I know,

C:\Users\Oscar\AppData\Roaming\Mozilla\Firefox\Profiles

only contains directories, so that is normal.

But can you use the results of that dir to get the directory name Windows expects to see when you drill down into the next folder, and then repeat with the next? The originally derived 8.3 names do not appear to be correct.

more options

Some confusion...

Batch files (as best I know) require path statements with max 8 character directory levels. As such, regardless of what the directory is named, it will only be accepted, if a level "name" is more than 8 characters, in the format XXXXXX~1 where the last digit can change to reflect multiples at the same level (in order of appearance - I believe). The DIR you requested yields "xbh4bkna.default-release" - which the batch file accepts as "xbh4bk~1". What am I missing? Thanks.

more options

Why are you using '8.3' file names and not the full file name? If you use a .cmd file then full file names shouldn't be a problem.

You can make Firefox create an automatic HTML backup (bookmarks.html) in the Firefox profile folder when Firefox is closed by setting browser.bookmarks.autoExportHTML to true on the about:config page.

This HTML backup is created by default in the profile folder as bookmarks.html every time you close Firefox, but you can set the path and file name via the browser.bookmarks.file pref on the about:config page.

The browser.bookmarks.file pref doesn't exist by default and you need to create a new String pref with the name browser.bookmarks.file and set the value to the full path of the backup bookmarks.html file including the file name.

more options

Oscar Leckliter said

The DIR you requested yields "xbh4bkna.default-release" - which the batch file accepts as "xbh4bk~1". What am I missing?

Because the directory name includes a dot, there is an "extension" you need to include in the 8.3 notation.

Do a

dir /x

to see what I mean.

Or, as cor-el suggests, test with the full directory names and see whether xcopy can handle it.

more options

Thanks for your reply but seems a ton of confusion. It appears you are unfamiliar with Win/DOS batch files. The file names are not 8.3. Possibly you are getting mixed up with the directory level names being limited to 8 characters. A batch fill allows for the execution of multiple commands, one at a time, in sequence. As my batch file is executed, 8 different xcopy commands are run, backing up data files from 8 different applications, incl Excel and Word. The command line attributes in the batch file provide for inspection of the source to any prior copied-to file and copy only if the source file has changed since the last iteration of the batch file. The result is that you get an incremental backup, saving a ton of space and resources.

As point of note, I can go into the directory tree in Windows File Explorer and copy and paste the .jsonlz4 file or files to the removable drive, "just" can't (currently) get the file to see those files as the batch file is executed.

more options

jscher2000 said

Oscar Leckliter said
The DIR you requested yields "xbh4bkna.default-release" - which the batch file accepts as "xbh4bk~1". What am I missing?

Because the directory name includes a dot, there is an "extension" you need to include in the 8.3 notation.

Do a

dir /x

to see what I mean.

Or, as cor-el suggests, test with the full directory names and see whether xcopy can handle it.

The batch directory name does NOT include a dot and is NOT in 8.3 format - its max 8 character, no "punctuation". 8.3 is the old DOS file name requirement. FYI, batch files have zero issue with long Excel and Work file names that are file type .xlsx and docx - thus the "problem" appears to have nothing to do with 8.3 anything. Thanks.

more options

Valittu ratkaisu

I didn't write a batch file, I just ran cmd.exe and used dir. That seems relevant to batch files, but I generally do not write batch files, so I could be wrong about that.

For me, dir requires an "extension" on the profile directory name -- a dot and the first 3 letters of the name of the profile, which is the format shown in the list when using dir with /x.

For example, if your profile is named default or default-release:

dir C:\Users\Oscar\AppData\Roaming\Mozilla\Firefox\Profiles\xbh4bk~1.DEF\bookma~1\*.*

Either way, I think we are in the realm of Windows and not Firefox at this point.

more options

OK...tried the added DEF and it worked. Learn something new every day. Thanks.