Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    WS Lounge VIP mrjimphelps's Avatar
    Join Date
    Dec 2009
    Location
    USA
    Posts
    3,396
    Thanks
    445
    Thanked 404 Times in 376 Posts

    Unable to Rename or Delete File/Folder With Long Filename

    Try opening a command prompt and deleting the files using DOS commands. You can try deleting them using the short version of the name.

    For example, if the "visible" name is "Thisisaveryveryverylongfilename.mp3", the short version of the name will likely be thisis~1.mp3.

    You will therefore run the following command: DEL THISIS~1.MP3 <enter>

  2. The Following User Says Thank You to mrjimphelps For This Useful Post:

    snalmond (2013-03-28)

  3. #2
    Lounger
    Join Date
    May 2012
    Posts
    26
    Thanks
    24
    Thanked 1 Time in 1 Post

    Unable to Rename of Delete File/Folder With Long Filename

    I downloaded some mp3 files from Amazon.com and the filenames turned out to be incredibly long. The resulting path and filenames exceeded 260 characters, so Windows won't handle them. I tried to rename the files with shorter filenames, but Windows did not allow renaming them. I tried to delete the files with long names and they seemed to disappear. I tried to delete the folder that contained them but could not. I now have the downloaded folder that, when clicked, is shown to be empty ("This folder is empty" is displayed). I checked its properties and it's reported to contain 1.35 Gb (the size of the music album downloaded). How might I get rid of the "empty" folder that appears to contain 1.35 Gb of data?

    Running Windows 7 Home Premium 64 bit SP1 on HP Elite (1.5 Tb HD) with Intel Core i7 970 @ 3.20 Ghz, 10 Gb memory

  4. #3
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,179
    Thanks
    47
    Thanked 983 Times in 913 Posts
    The annoying part is it's only Windows Explorer that can't handle the long names. Windows doesn't mind.

    Try this in a Command Prompt.
    rd /s first_part_of_subdirectory_name

    e.g. if the file is called "C:\temp\Files\verylongfilenames.ext"
    rd /s C:\temp\Files

    Failing that you should be able to rename the directory to a single character to make the whole lot shorter than 255 characters.

    cheers, Paul

  5. The Following User Says Thank You to Paul T For This Useful Post:

    snalmond (2013-03-28)

  6. #4
    WS Lounge VIP mrjimphelps's Avatar
    Join Date
    Dec 2009
    Location
    USA
    Posts
    3,396
    Thanks
    445
    Thanked 404 Times in 376 Posts
    Not sure what happened, but the system put my reply ahead of the OP's post.

  7. #5
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Snalmond,

    Another approach would be to open a command prompt and use the Subst command to assign the path, or the first part of the path, to an unused drive letter.

    To get help with the Subst command enter Subst /? at the command prompt. HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  8. The Following User Says Thank You to RetiredGeek For This Useful Post:

    snalmond (2013-03-28)

  9. #6
    Lounger
    Join Date
    May 2012
    Posts
    26
    Thanks
    24
    Thanked 1 Time in 1 Post
    mrjimhelps, Paul T and RetiredGeek, I thank you all for your recommendations. Please pardon if my ignorance is shining too brightly. mrjimhelps and Paul T, it appears that I need to be able to see or, at least know, the filenames of the specific files I wish to delete in order to use your suggestions. When I click on the folder (that I wish to delete) that holds the files I wish to delete, nothing shows other than "This folder is empty" so I can't see the filenames and don't know them. The path is ...\my music\amazon mp3\various artists\[folder I want to delete]. Can I delete the folder using the command prompt to "Del [path]\foldername"? I haven't used DOS in decades.

    RetiredGeek, it looks like a lovely suggestion and I did pull up "Subst /?" via the command prompt. However, the short response left me quaking in my DOS-deficient boots. I'm afraid to attempt that without step-by-step hand holding.

    [As an aside, I did solve the problem of not being able to use the long name files by playing them from the Amazon downloader, recording them and naming the resulting files myself, so all I need to do now is remove the "empty" 1.35 Gb folder.]

  10. #7
    WS Lounge VIP mrjimphelps's Avatar
    Join Date
    Dec 2009
    Location
    USA
    Posts
    3,396
    Thanks
    445
    Thanked 404 Times in 376 Posts
    Quote Originally Posted by snalmond View Post
    It appears that I need to be able to see or, at least know, the filenames of the specific files I wish to delete in order to use your suggestions. When I click on the folder (that I wish to delete) that holds the files I wish to delete, nothing shows other than "This folder is empty" so I can't see the filenames and don't know them. The path is ...\my music\amazon mp3\various artists\[folder I want to delete]. Can I delete the folder using the command prompt to "Del [path]\foldername"? I haven't used DOS in decades.
    Try the following:

    * Open a command prompt.
    * Go to the drive and folder in question.
    --> To get to the drive in question, type C: <enter> (put the correct drive letter if it isn't C)
    --> To get to the correct folder, type CD \<put the entire path here> <enter>
    * Type DIR /P<enter> (the /P will cause the display to pause after each screenful, so that you can read it)

    If you are in the correct drive and folder, the DIR command should give you the "8.3" or "short" name of the files.

    Once you get the short form of the name, you can then type DEL <shortname> <enter>

  11. #8
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Snalmond,


    Syntax SUBST newdriveletter: longdrivepath:
    Example SUBST Q: C:\Windows\System32\PowerShell\v1.0\en-US


    Now can address C:\Windows\System32\PowerShell\v1.0\en-US as simply Q:
    Subst Example.JPG

    To get rid of the substitution simply SUBST /D Q:
    delsubst.JPG
    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  12. The Following User Says Thank You to RetiredGeek For This Useful Post:

    mrjimphelps (2014-02-24)

  13. #9
    Lounger
    Join Date
    May 2012
    Posts
    26
    Thanks
    24
    Thanked 1 Time in 1 Post
    Thanks mrjimphelps (apologies for having left the "p" out last time). I got to the desired folder and saw the files I want to delete. The filenames did show up in the long (as opposed to shortened) ~1 form. Unfortunately, I must have either made a typo or inserted "(" when it showed "<" or vice-versa. I wouldn't be surprised if I made typos, as the filename alone has 209 characters (some in German) including () and/or <> + ext. I'll try again later with a, hopefully, clearer head and truer typing hands.

    Steve

  14. #10
    Super Moderator
    Join Date
    Jun 2011
    Location
    New England
    Posts
    4,746
    Thanks
    171
    Thanked 649 Times in 572 Posts
    Quote Originally Posted by snalmond View Post
    mrjimhelps, Paul T and RetiredGeek, I thank you all for your recommendations. Please pardon if my ignorance is shining too brightly. mrjimhelps and Paul T, it appears that I need to be able to see or, at least know, the filenames of the specific files I wish to delete in order to use your suggestions.
    Neither of their suggestions required filenames, just the folder path.


    Quote Originally Posted by snalmond View Post
    When I click on the folder (that I wish to delete) that holds the files I wish to delete, nothing shows other than "This folder is empty" so I can't see the filenames and don't know them. The path is ...\my music\amazon mp3\various artists\[folder I want to delete]. Can I delete the folder using the command prompt to "Del [path]\foldername"? I haven't used DOS in decades.
    No, but Paul's suggestion (rd = Remove Directory) was the command to do exactly that.


    Bruce

  15. The Following User Says Thank You to BruceR For This Useful Post:

    snalmond (2013-03-28)

  16. #11
    Lounger
    Join Date
    May 2012
    Posts
    26
    Thanks
    24
    Thanked 1 Time in 1 Post
    Thank you, Bruce. I better understand that now thanks to your comment and another close look at Paul's recommendation. I'll try that.
    Steve

  17. #12
    Super Moderator
    Join Date
    Jun 2011
    Location
    New England
    Posts
    4,746
    Thanks
    171
    Thanked 649 Times in 572 Posts
    Quote Originally Posted by mrjimphelps View Post
    If you are in the correct drive and folder, the DIR command should give you the "8.3" or "short" name of the files.
    Quote Originally Posted by snalmond View Post
    I got to the desired folder and saw the files I want to delete. The filenames did show up in the long (as opposed to shortened) ~1 form.
    Use DIR /X or DIR/-N to display short filenames:

    How to convert a long filename to a short filename

    MS-DOS DIR /X Command - Display short names for non-8dot3 file names

    Bruce

  18. #13
    WS Lounge VIP mrjimphelps's Avatar
    Join Date
    Dec 2009
    Location
    USA
    Posts
    3,396
    Thanks
    445
    Thanked 404 Times in 376 Posts
    Quote Originally Posted by BruceR View Post
    Neither of their suggestions required filenames, just the folder path.



    No, but Paul's suggestion (rd = Remove Directory) was the command to do exactly that.


    Bruce
    You're right. I didn't notice the "/s" at the end of the RD command, which allows you to delete a non-empty directory.

  19. #14
    Lounger
    Join Date
    May 2012
    Posts
    26
    Thanks
    24
    Thanked 1 Time in 1 Post
    Problem solved. This has been an educational experience, and I thank you all for that. I temporarily shortened the names of successive subdirectories and was able to shorten the path sufficiently to allow me to rename those files with monstrously long names. After that I was able to delete the files and the directories in which they resided. Thanks again for your kind assistance.

    Steve

  20. #15
    WS Lounge VIP mrjimphelps's Avatar
    Join Date
    Dec 2009
    Location
    USA
    Posts
    3,396
    Thanks
    445
    Thanked 404 Times in 376 Posts
    There are usually plenty of ways to skin a cat.

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •