How can I copy files when I get a file name too long error?

November 15, 2026 4 answers
Asked by n.46!bracketry

I'm copying folders containing subfolders and PDFs from a FAT32 SD card to an ext4 drive on my Linux laptop. Both rsync and the file manager report that some names are too long. Would renaming be the best fix, or is there another way to copy them?

Answers

6t+notchline_413

First figure out whether it's an individual name or the whole path causing trouble. Ext4 limits each filename component to 255 bytes, not necessarily 255 characters. Accented letters and emoji can take multiple bytes, so a name accepted on the SD card can still be too long on ext4.

Look at the names reported in the errors and check their byte lengths. If one component exceeds the limit, shortening that file or directory name is the straightforward fix. Keep a record of any changes if the original names matter.

Reply to this answer
a715!spool_6

Try copying into a short destination path near the root of the drive, rather than several folders deep. If that works, the full path may be the problem. If the same individual names still fail, a shorter destination won't get around ext4's per-name limit.

Reply to this answer
u31!pocket_684

An archive is another option if you mainly need to store or move the files. Put the folders in a tar archive on the card, then copy the archive to the laptop. That doesn't solve the naming problem when you extract it onto ext4, though. The offending names would still need changing for ordinary access there.

Reply to this answer
r47~deskbell_208

If there are lots of failures, a script to identify and shorten names could save some work. Have it preview the proposed changes first, preserve file extensions, and check for duplicate names before actually renaming anything. Keep the originals on the card until you've checked the copied files.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions