/    Sign up×
Community /Pin to ProfileBookmark

File management

I have multiple “mirrors” setup. What I want to do is automatically add new files from all mirrors.

All of these mirrors cannot be accessed locally. From what I understand, this means I need to setup an external script to get the files.

I’m just curious if anyone has any better ideas on how to go about doing this.

Any and all suggestions are greatly appreciated. ?

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@NogDogSep 11.2006 — Not sure if this is what you're asking, but PHP has a set of [url=http://www.php.net/manual/en/ref.ftp.php]FTP functions[/url] you could use to mange files amongst the sites.
Copy linkTweet thisAlerts:
@neenach2002authorSep 11.2006 — I don't really want to manage the files themselves - the files will be part of a downloads system I am making.

At the moment, I'm using the following code:

[code=php] $file = "list.php";
$filepath = $mirror['url'] . "/" . $file;
require $filepath;
returnfiles();
print $out;[/code]


Inside of the list.php file:

[code=php]

function returnfiles(){

$folder = 'Test';
//$mirror['url'] = 'http://dl1.animekatsu.net';

$dirs = dirList($folder);
//for($x = 0;$x<count($dirs);$x++){
foreach( $dirs as $dir ){
//$dir = $dirs[$x];
if( $dir != '.' && $dir != '..'){

$directory = $folder . "/" . $dir;

$catdata['directory'] = $dir;
$catdata['mirrorurl'] = $mirror['url'];
//$cat['data'] = $this->tbl->MAP2str($data);

//$cat['name'] = str_replace('_', ' ', $dir);

//$cat['query']= $cat['name'];
//$catdata = $cat;



//$this->make_cat($cat['name'], $cat['query'], $cat['data']);


//$x++;
$out .= "<b>".$dir."</b><br>";
$out .= "<pre>".print_r($catdata,1)."</pre>";
$files = fileList($directory);
//$fileinfo = array();
//$x = 0;
if( count($files) != 0 ){
// $y = 0;
//Change below part to call the mass add function instead of printing the info.
for( $y=0;$y<count($files);$y++ ){
//foreach( $files as $file ){
//$data = array();
$file['name'] = $files[$y];
$path = $folder . "/" . $dir . "/" . $file['name'];
//$url = $mirror['url'] . "/" . $path . "/" . $data['name'];
//$data['path'] = $folder;
$file['filesize'] = fileSize($path);
$file['filename'] = $file['name'];
$file['md5'] = md5_file($path);
$file['series'] = str_replace('_', ' ', $dir);
//$data['author'] = "blah";


//$fileinfo[$y] = $file;
//$file = $data;
//$y++;
$out .= "<pre>".print_r($file,1)."</pre>";

//$this->do_mass_add_files($file);

}

}

}

}

return $out;
}[/code]


I'd like to stay away from the FTP functions since all I really want to do is get a little information on each file and store it to the database.

I can't find anything wrong with my code - though my brain is completely fried from the amount of work I have done this week.

BTW, the error I get is:

Fatal error: Call to undefined function: returnfiles() in /home/soanime/public_html/anivision/sources/xmod/download.php on line 230

The file works fine by itself.
Copy linkTweet thisAlerts:
@neenach2002authorSep 12.2006 — Any ideas guys?
×

Success!

Help @neenach2002 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...