Subject: Script for easyfile plugin..

Posted on: 06/10/08 03:58am
By: Anonymous

I dunno if any of you have used the easyfile plugin in the past.. but if you did and then later wanted to go with a different filemanager then you probably discovered all your files are being stored as an Octstream. They still work with a different filemanager but the name is all crazy numbers based on date, ect.. blah.. blah..

Anyways heres a simple script that will restore he original names. Just had to crap it out a bit ago so I thought I'd toss it here. If anyone has a better place for this post.. feel free to relocate it there.



<?php


// Config

$dbhost = "localhost";
$dbuser = "XXXX";
$dbpass = "XXXX";
$dbname = "XXXXXX";

$path = "/path/to/files"; // No trailing slash!



mysql_connect("$dbhost", "$dbuser", "$dbpass"Wink or die(mysql_error());
mysql_select_db("$dbname"Wink or die(mysql_error());
$query = mysql_query("select fileid, filename from gl_easyfile"Wink;
while($row = mysql_fetch_array($query)){
$fileid= $row['fileid'];
$filename = $row['filename'];

echo "Working with $fileid --\n";
$x = rename("$path/$fileid","$path/$filename"Wink;
if($x==true){
echo "$filename renamed successfully./n";
}else{
echo "Something bad happened. Files not renamed.";
}



}

?>

Re: Script for easyfile plugin..

Posted on: 06/10/08 05:53am
By: ::Ben

Hi Astatalas,

Where can I found the easyfile plugin?

Thanks.

::Ben

Re: Script for easyfile plugin..

Posted on: 06/10/08 06:17am
By: Dirk

Quote by: cordiste

Where can I found the easyfile plugin?


Was that a trick question?

bye, Dirk

Re: Script for easyfile plugin..

Posted on: 06/10/08 06:43am
By: ::Ben

:doh: Yes I made a search on easyfile plugin

To much informations hide information Smile

Thank you Dirk.

::Ben

Geeklog - Forum
https://www.geeklog.net/forum/viewtopic.php?showtopic=84721