How to rename a (too) long file name

14

7

I have downloaded this pdf file with a very long name, which cannot be opened by Adobe Reader or by Adobe Professional because it has "invalid file name".

It cannot be renamed using the DOS prompt but it has "too long name or extension". I tried to delete so that my recovery program can rename then restore it, it but it won't be deleted as a file.

The only way to delete it is by deleting the folder where it was downloaded into (which I did, but restored it later). It can't also be printed or moved or copied to another folder. Is there a way to open or rename these kinds of files?

I tried to rename it by right clicking the title but what appears is a shortened version of the options with no rename function. I then discovered that it has a password protection, which is not provided by the website from which I downloaded it.

elmer m

Posted 2013-08-29T09:01:44.283

Reputation: 143

Question was closed 2013-08-29T10:57:16.327

1This is not a duplicate because it asks how to rename the file rather than delete it. The answers in the linked 'duplicate' question address how to delete the file without retaining it. – Tim MB – 2019-04-23T10:01:21.513

Edited the question. The fact that it's a protected PDF is irrelevant to your question, but I can understand you thinking it has something to do with the issue. – Jan Doggen – 2013-08-29T09:09:00.283

Answers

15

To rename a file with long file name you can try to rename it by using the short (8+3) windows name.

  • open command prompt and find the directory with the file
  • type dir /X
  • this command will show the short 8+3 names followed by long names
  • find the file you want to rename and use command

    rename "shortname" "newname"

  • "shortname" is 8+3 name and "newname" is name you want to rename to

Example: if you have a file named "verylongfilename.txt", it should have short name "verylo~1.txt" so you would use command

rename verylo~1.txt newname.txt

and should end up with file "newname.txt".

T. Kaltnekar

Posted 2013-08-29T09:01:44.283

Reputation: 7 636

you're awesome man, clean and genious answer – Alexander.Iljushkin – 2014-10-02T18:38:42.193

This doesnt work with filenames which start with #+some numbers! such as #46574 .url123123... . i tried this and failed! – Rika – 2014-10-26T18:39:15.613

3This doesn't seem to work in win10. Any ideas? – AHungerArtist – 2017-04-17T03:22:28.493

2

Hi! This did not work for me. But the solution in this YouTube video solved it: https://www.youtube.com/watch?v=qQTyTprFAOg

– swdeveloper – 2017-07-28T11:50:20.587

.....Really? – Andrew – 2017-10-27T23:44:15.413

In case the YouTube video disappears: It says to navigate to the directory in WinRAR. There you can rename too long filenames by selecting the file and pressing F2. – root – 2019-07-16T21:19:51.123