News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

help needed downloading the attachment folder

Started by ron993, May 24, 2017, 01:59:41 PM

Previous topic - Next topic

ron993

we have an offroad club running on version 2.0 RC3.  Unfortunately our membership has dwindled down to basically nothing.  I was hoping to download the attachment folder which is all pictures from the last 11 years of offroad trips.  I am hoping to use the old pictures to get people to come back to the club. If people do not come back we will shut down the website and will want a copy of all the pictures anyway.

Is there an easy way to download the attachment folder?  I tried using FTP, downloaded filezilla and downloaded the folder but the files just show as file with no extension.

Thanks in advance

Ronnie

Arantor

Not really, no, the files are stored in the attachment system that way so people can't just link to the files directly if they aren't otherwise able to view the pictures.

shawnb61

Were the files encrypted? 

I don't think the files are encrypted or anything.  Just renamed & the extensions were removed.  I think the renaming pattern in 2.0 changed a bit over the years, e.g., JoesPic.jpg, depending on when it was uploaded, may be renamed:
  Joespic   (name + no extension)
  Joespicjpg4849793284329048732094032984    (name + hash + no extension)
  4849793284329048732094032984    (hash + no extension)

So...  What you want to do is largely dependent on volume & level of tech savvy. 

If the volume is small, I'd attempt just downloading them & renaming them to see what works.

If the volume is mid-high, I'd do an Excel export of the SMF attachments folder for guidance.   It will tell you the target extension for each attachment.   Given the different (re)naming standards I've seen,  this may take a bit of guesswork... 

If the volume is very high, and level of tech savvy is high, you may even be able to use the SMF attachments table information to build a batch script to do renames to reconstruct the original attachments.

I have not tried this.  I would start with a few files & experiment for a day or two.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Kindred

Also, be aware that filezilla will screw up files that have no extension unless you fix the program to use BIN transfer type instead of ASCII
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Illori

Quote from: shawnb61 on May 24, 2017, 05:42:29 PM

If the volume is mid-high, I'd do an Excel export of the SMF attachments folder for guidance.   It will tell you the target extension for each attachment.   Given the different (re)naming standards I've seen,  this may take a bit of guesswork... 


you mean attachments table right?

a10

Download them (be sure to set Filezilla Transfer type to Binary !), then do some auto renaming, am using the (excellent) Freecommander filemanager, see attachment.

...assuming most or all files are are of same type (a mix of doc, pdf, jpg, png etc etc would take 'some' time ro sort out :O)
2.0.19, php 8.0.23, MariaDB 10.5.15. Mods: Contact Page, Like Posts, Responsive Curve, Search Focus Dropdown, Add Join Date to Post.

Gluz

One way to go is download all the attachment directory (as said before, if using Filezilla, set the file transfer type to BIN) and from the database search in the attachments table for the hash and you would see the real file name for that file. You can export that table as CSV and strip down all except the file name and hash and make a script to rename all files.

Other way is making a PHP script to read your database and create a copy of the attachments directory with the real file name.

shawnb61

Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

shawnb61

#8
BTW, this turns out to be VERY easy in Windows using Excel as described above.

Download & make a safe copy of your attachments directory.

Using phpMyAdmin, export your attachments table to an Excel readable .csv.

Download & import that .csv into Excel.   

In my Excel sheet, column A had the attachment ID & column F had the filename. 

Propagate the following in a column to the right of your attachment table data (this is the entry for row 2):
       = "ren " & A2 & "_*.* " & """" & A2 & "_" & F2 & """"

This will create a column of data that looks like:
   ren 15890_*.* "15890_ftp2.jpg"
   ren 15891_*.* "15891_ftp2.jpg_thumb"
   ren 15892_*.* "15892_Moody Pads.tsl"
   ren 15893_*.* "15893_avatar_22660_1494687462.jpeg"
   ren 15894_*.* "15894_Amp Hex Pad.tsl"

Copy & paste that column into a text editor & save as a .bat file.

Execute the bat file within a safe copy of the directory in question. 

This mechanism works for all of the weird filesystem names that were used over time, because they all start with <attach_id>_.

I kept the attachment ID on the target name to minimize name conflicts. 

Hope this helps!
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Dave J

Quote from: a10 on May 24, 2017, 06:51:18 PM
Download them (be sure to set Filezilla Transfer type to Binary !), then do some auto renaming, am using the (excellent) Freecommander filemanager, see attachment.

...assuming most or all files are are of same type (a mix of doc, pdf, jpg, png etc etc would take 'some' time ro sort out :O)

Although I have never used the program a10 has mentioned, I have just renamed my files to .jpg and opened them in a program like Paint or Paint.net etc. 9/10 they open no problem, once you open them then just rename them to something you want to remember them by and job done.

The only time this will not work is if the file your trying to open was not an image file when it was uploaded.
If you want quizzes to add to the new SMF2.1 quiz mod go here . There are also walkthroughs in the forum to explain how to install them and other tips.

ron993

#10
should be about 99% jpg pictures

all of the file names look like this   232_Gilmer_Feb_2007_004_jpg413f9697661f4d709053c24ad1d25fae

I can rename the file and delete the text after jpg and change the _ to . and the file will work.  Only problem is there are about 1500 pictures


I used Free Commander to change add the .jpg extension to the file names and they all work now.

Thanks for the help

showngo

From the server you need to compress the attachment folder and then download it as a single file.  You can tarball it with puTTY but filezilla will only acknowledges 9998 files, you loose everything after that.
Once compressed,  download the tar file and open it on your computer.  There, they will be .file extentions but "open with paint"
There will not be thumbnail previews or the common names (jeep1)  they will be the attachment string. 

I have 10 folders of attachemts that i saved that way.

fishoaus

Hi would this still work in 2.0.18, ????????????????? need help to complete if it does

Advertisement: