Skip to main content
Amal
Associate II
January 23, 2020
Question

Copy directorys from pendrive to sdcard using fatfs..

  • January 23, 2020
  • 5 replies
  • 2194 views

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?

This topic has been closed for replies.

5 replies

Tesla DeLorean
Guru
January 23, 2020

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 VenmoUp vote any posts that you find helpful, it shows what's working..
dbgarasiya
Senior
January 25, 2020

just read from one drive and write to another drive

dbgarasiya
Senior
January 28, 2020

Have you tried ?

Amal
AmalAuthor
Associate II
January 28, 2020

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

Tesla DeLorean
Guru
February 3, 2020

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 VenmoUp vote any posts that you find helpful, it shows what's working..
Amal
AmalAuthor
Associate II
February 4, 2020

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

dbgarasiya
Senior
February 3, 2020

is file name length is more than 13 character ?

Amal
AmalAuthor
Associate II
February 4, 2020

yes its length is more than 13