forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Recursive function to get absolute path of all file in a dir

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Sat Apr 26, 2008 4:59 am    Post subject: Recursive function to get absolute path of all file in a dir Reply with quote

I have to copy a entire directory, but i'm not been able to write a function to get all the file in a directory and subdirectory,
has anyone write a similar function?
_________________
Get Xplora!
Back to top
View user's profile Send private message
Insert_witty_name



Joined: 10 May 2006
Posts: 376

PostPosted: Sat Apr 26, 2008 5:06 am    Post subject: Reply with quote

If only your ability to click 'New Topic' was as good as your ability to click 'Search'...

This is for recursively deleting, but is the same idea: http://forums.ps2dev.org/viewtopic.php?t=6859
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Sat Apr 26, 2008 5:16 am    Post subject: Reply with quote

LOL @ IWN
_________________

Upgrade your PSP
Back to top
View user's profile Send private message
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Sat Apr 26, 2008 5:23 am    Post subject: Reply with quote

Tanks, but there is to include specific library? what is newlib?
And i use the first or the second function?
Code:

memset(&dirent, 0, sizeof dirent);

Where i'have tu put this in the second function ( if with this is perfect ).
_________________
Get Xplora!
Back to top
View user's profile Send private message
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Sat Apr 26, 2008 5:41 am    Post subject: Reply with quote

The function of pspwill will not work correcly!
_________________
Get Xplora!
Back to top
View user's profile Send private message
Insert_witty_name



Joined: 10 May 2006
Posts: 376

PostPosted: Sat Apr 26, 2008 6:56 am    Post subject: Reply with quote

ne0h.

http://www.cprogramming.com/

You're like the spotty teenager at the prom asking the lead cheerleader for a dance.

Way out of your league.

Learn to program, then apply that knowledge to the PSP.
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat Apr 26, 2008 7:24 am    Post subject: Reply with quote

Insert_witty_name wrote:
ne0h.

http://www.cprogramming.com/

You're like the spotty teenager at the prom asking the lead cheerleader for a dance.

Way out of your league.

Learn to program, then apply that knowledge to the PSP.


Okay, this is going into my quotes file. I only aspire to this level of greatness in responding to noobs. :D
Back to top
View user's profile Send private message AIM Address
angelo



Joined: 29 Aug 2007
Posts: 168

PostPosted: Sat Apr 26, 2008 9:43 am    Post subject: Reply with quote

Quote:
Okay, this is going into my quotes file. I only aspire to this level of greatness in responding to noobs. :D


...and the odd team member... =P
Back to top
View user's profile Send private message Send e-mail MSN Messenger
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Sat Apr 26, 2008 11:37 pm    Post subject: Reply with quote

uff...
Can you do anything then kidding me?
If i do this question in other forums i've no response because this is not a forum to discute about the PSP programming!
_________________
Get Xplora!
Back to top
View user's profile Send private message
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Sun Apr 27, 2008 12:51 am    Post subject: Reply with quote

I've resolved, excuse me for the post before...
_________________
Get Xplora!
Back to top
View user's profile Send private message
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Sun Apr 27, 2008 8:49 pm    Post subject: Reply with quote

I've writed the function for copy a entire directory, but it will creat a empty file with the name of directory, not a directory, this is the funct:
Code:

//------- fileDest="ms0:/PSP/GAME"

//------- fileSrc="ms0:/ISO"

sceIoMkdir(fileDest, PSP_O_RDWR);

Copydir(fileSrc, fileDest);

and the Copydir funct:
Code:

void Copydir(char *dir, char* destination)
{
 int fd;
 SceIoDirent dirent;
 fd = sceIoDopen(dir);
 char fullname[512];
 char dest[512];
 memset(&dirent, 0, sizeof dirent);
 while (sceIoDread(fd, &dirent) > 0)
 {
  sprintf(fullname, "%s/%s", dir, dirent.d_name);
  sprintf(dest, "%s/%s", destination, dirent.d_name);
  if ((FIO_S_IFREG & (dirent.d_stat.st_mode & FIO_S_IFMT)) == 0)
      {
             sceIoMkdir(dest, PSP_O_RDWR);
             Copydir(fullname, dest);
         }
  else
      {
      fileCopy(fullname, dest);
      }
  }
 sceIoDclose(fd);
}


When i create a dir with sceIoMkdir, can i put a absoluto path? or i must put only the name?
_________________
Get Xplora!
Back to top
View user's profile Send private message
pspZorba



Joined: 22 Sep 2007
Posts: 156
Location: NY

PostPosted: Mon Apr 28, 2008 12:42 am    Post subject: Reply with quote

Quote:
When i create a dir with sceIoMkdir, can i put a absoluto path? or i must put only the name?



You can just try ...

... in place of asking, you will have a faster answer, and people will continue to help you,

With this kind of question that you can check by yourself, you make people unwilling to help you.
_________________
--pspZorba--
NO to K1.5 !
Back to top
View user's profile Send private message
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Mon Apr 28, 2008 1:57 am    Post subject: Reply with quote

i've tryed but I haven't find the error, and then i've ask...
However, i've resolved!
_________________
Get Xplora!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group