cancel
Showing results for 
Search instead for 
Did you mean: 

Copy directorys from pendrive to sdcard using fatfs..

Amal
Associate III

Hi all

I am able to mount both drives and open ,read,write files in both drives...now i need to copy folders from pendr​ive to sd card..is it possible? .fatfs don't have copydirectory function..do i need to create copydirectory function...will accessing both drives simultaneously for copying will work in fatfs?

8 REPLIES 8

You will need to write the code to do this. FatFs provides the means to enumerate thru the files in the directory, and you will need to create new files in the destination directory, and copy the data through memory with f_read/f_write, and if you want the dates/attributes to be the same you'll have to set those at the end.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
dbgarasiya
Senior II

just read from one drive and write to another drive

dbgarasiya
Senior II

Have you tried ?

Amal
Associate III

yeah i tried ...its working i am able to copy files and directory .but one issue i noticed is that some file (rarely)names ends with ~1

for example

test.txt will be orginal file but after copying to sdcard the filename will be te~1.txt

dbgarasiya
Senior II

is file name length is more than 13 character ?

Need to be aware of LFN (Long Filename) usage when enumerating the source files/directories, and generating the destination copies.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

yes its length is more than 13

thank you ...its solved ,i enabled LFN support