Recursive function to get absolute path of all file in a dir
Recursive function to get absolute path of all file in a dir
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?
has anyone write a similar function?
Get Xplora!
-
- Posts: 376
- Joined: Wed May 10, 2006 11:31 pm
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
This is for recursively deleting, but is the same idea: http://forums.ps2dev.org/viewtopic.php?t=6859
Tanks, but there is to include specific library? what is newlib?
And i use the first or the second function?
Where i'have tu put this in the second function ( if with this is perfect ).
And i use the first or the second function?
Code: Select all
memset(&dirent, 0, sizeof dirent);
Get Xplora!
-
- Posts: 376
- Joined: Wed May 10, 2006 11:31 pm
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.
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. :DInsert_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.
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:
and the Copydir funct:
When i create a dir with sceIoMkdir, can i put a absoluto path? or i must put only the name?
Code: Select all
//------- fileDest="ms0:/PSP/GAME"
//------- fileSrc="ms0:/ISO"
sceIoMkdir(fileDest, PSP_O_RDWR);
Copydir(fileSrc, fileDest);
Code: Select all
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);
}
Get Xplora!
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 !
NO to K1.5 !