Advertisement:

Author Topic: help needed downloading the attachment folder  (Read 1085 times)

Offline ron993

  • Newbie
  • *
  • Posts: 2
help needed downloading the attachment folder
« on: May 24, 2017, 01:59:41 PM »
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
« Last Edit: May 24, 2017, 02:15:47 PM by ron993 »

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,225
    • StoryBB/StoryBB on GitHub
Re: help needed downloading the attachment folder
« Reply #1 on: May 24, 2017, 02:18:09 PM »
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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline shawnb61

  • Support Specialist
  • Sophist Member
  • *
  • Posts: 1,271
    • sbulen on GitHub
Re: help needed downloading the attachment folder
« Reply #2 on: May 24, 2017, 05:42:29 PM »
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

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 58,329
  • Gender: Male
    • Kindred-999 on GitHub
Re: help needed downloading the attachment folder
« Reply #3 on: May 24, 2017, 05:45:15 PM »
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
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 51,015
Re: help needed downloading the attachment folder
« Reply #4 on: May 24, 2017, 06:07:38 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?

Offline a10

  • Charter Member
  • Sr. Member
  • *
  • Posts: 855
Re: help needed downloading the attachment folder
« Reply #5 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)
2.0.15, ssl, php 7.1.31, MySQL 10.3.13-MariaDB~bionic
Mods: Contact Page, Like Posts, Responsive Curve, Search Focus Dropdown, Add Join Date to Post.

Offline Gluz

  • Sr. Member
  • ****
  • Posts: 985
  • Gender: Male
Re: help needed downloading the attachment folder
« Reply #6 on: May 24, 2017, 07:04:37 PM »
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.
Need help with PHP, HTML, CSS, Themes or MODs?

Quote
Think in spanish, habla en inglés.

Offline shawnb61

  • Support Specialist
  • Sophist Member
  • *
  • Posts: 1,271
    • sbulen on GitHub
Re: help needed downloading the attachment folder
« Reply #7 on: May 24, 2017, 07:31:46 PM »
you mean attachments table right?

Yes, sorry for the goof!
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Offline shawnb61

  • Support Specialist
  • Sophist Member
  • *
  • Posts: 1,271
    • sbulen on GitHub
Re: help needed downloading the attachment folder
« Reply #8 on: May 24, 2017, 11:38:25 PM »
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):
       
Code: [Select]
= "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!
« Last Edit: May 25, 2017, 12:11:39 AM by shawnb61 »
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Offline davejo

  • Jr. Member
  • **
  • Posts: 309
    • Dave's Hobby Workshop
Re: help needed downloading the attachment folder
« Reply #9 on: May 25, 2017, 06:40:27 AM »
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 'Quiz' questions Click here
Quiz Test Site Link

Offline ron993

  • Newbie
  • *
  • Posts: 2
Re: help needed downloading the attachment folder
« Reply #10 on: May 25, 2017, 10:23:00 AM »
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
« Last Edit: May 25, 2017, 11:20:58 AM by ron993 »

Offline showngo

  • Jr. Member
  • **
  • Posts: 143
Re: help needed downloading the attachment folder
« Reply #11 on: May 27, 2017, 07:30:46 PM »
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.