Skip to main content
Visitor 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

    Graduate II
    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.

    Visitor II
    January 25, 2020

    just read from one drive and write to another drive

    Visitor II
    January 28, 2020

    Have you tried ?

    AmalAuthor
    Visitor 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

    Graduate II
    February 3, 2020

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

    AmalAuthor
    Visitor II
    February 4, 2020

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

    Visitor II
    February 3, 2020

    is file name length is more than 13 character ?

    AmalAuthor
    Visitor II
    February 4, 2020

    yes its length is more than 13