Thread: File Functions
View Single Post
  #1  
Old 06-29-2008, 08:34 PM
TheStan TheStan is offline
Stan?
Join Date: May 2008
Location: U.S.
Posts: 100
TheStan is on a distinguished road
Send a message via AIM to TheStan Send a message via MSN to TheStan
File Functions

Recently, I found a need for a few quick access file functions. They may or may not help you but I thought it would be helpful to release to the public.

I replaced the percent signs with "#" signs. For the problem with the request error.

PHP Code:
public function getfolder(folder) {
  
temp.folder.loadfolder(folder @ "*", 0);
  return 
temp.folder;
}
public function 
getfilelines(file) {
  
temp.lines.loadlines(file);
  return 
temp.lines;
}
public function 
getfilevars(file) {
  
temp.vars = new TStaticVar();
  
temp.vars.loadvars(file, 0);
  return 
temp.vars.getdynamicvarnames();
}
public function 
garbagecollect(fold, filetype) {
  
temp.folder = null;
  
temp.f = null;
  
temp.file = null;
  
  
folder.loadfolder(format("#s*.#s", fold, filetype), 0);
  echo(
folder);
  for (
f: folder) {
    if (
filesize(format("#s#s", fold, f)) < 1) {
      
//deletefile(folder @ f);
      //deletefile(f);
    
}
    else {
      
file = new TStaticVar();
      
file.loadvars(format("#s#s", fold, f));
      
      if (
file.getdynamicvarnames().size() < 1) {
        
//deletefile(folder @ f);
        //deletefile(f);
      
}
    }
  }
} 
Determine whether or not you like the code through the reputation.
Reply With Quote