+ Post New Thread
Results 1 to 10 of 10
Windows Server 2000/2003 Thread, Can't delete pesky folders with a space at the end of their names in Technical; I was doing some housekeeping on one of our file servers and I noticed the backup routine was bleating about ...
  1. #1

    tech_guy's Avatar
    Join Date
    May 2007
    Location
    That little bit in the middle of Little Old England
    Posts
    8,106
    Thank Post
    1,901
    Thanked 1,340 Times in 739 Posts
    Blog Entries
    3
    Rep Power
    394

    Can't delete pesky folders with a space at the end of their names

    I was doing some housekeeping on one of our file servers and I noticed the backup routine was bleating about being unable to access a handful of folders in the users area. On closer inspection it looks like the affected users have created a folder to house website files, either manually or my copying a website. The folders have no security properties and the folder name ends with a space. The folders are empty.

    I can't delete them, taking ownership has no effect, and MS Article ID: 320081 is as much use as a eunuch in a brothel.

    Any suggestions much appreciated!

  2. #2

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,229
    Thank Post
    1,056
    Thanked 1,066 Times in 623 Posts
    Rep Power
    739
    Can you use RD or deltree from command line ? If not, I have a program which may help - I'll check to see what it's called.......

  3. #3

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,229
    Thank Post
    1,056
    Thanked 1,066 Times in 623 Posts
    Rep Power
    739
    This is the program that's got me out of a few problems before with this sort of thing.

    Download Unlocker 1.9.0 - FileHippo.com

  4. 2 Thanks to mattx:

    gavlar (25th June 2013), tech_guy (10th January 2011)

  5. #4

    tech_guy's Avatar
    Join Date
    May 2007
    Location
    That little bit in the middle of Little Old England
    Posts
    8,106
    Thank Post
    1,901
    Thanked 1,340 Times in 739 Posts
    Blog Entries
    3
    Rep Power
    394
    Quote Originally Posted by mattx View Post
    Can you use RD or deltree from command line ? If not, I have a program which may help - I'll check to see what it's called.......
    Nope & thanks!

  6. #5

    tech_guy's Avatar
    Join Date
    May 2007
    Location
    That little bit in the middle of Little Old England
    Posts
    8,106
    Thank Post
    1,901
    Thanked 1,340 Times in 739 Posts
    Blog Entries
    3
    Rep Power
    394
    Quote Originally Posted by mattx View Post
    This is the program that's got me out of a few problems before with this sort of thing.

    Download Unlocker 1.9.0 - FileHippo.com
    Brilliant! Thanks Matt.

  7. #6

    Hightower's Avatar
    Join Date
    Jun 2008
    Location
    Cloud 9
    Posts
    4,920
    Thank Post
    494
    Thanked 690 Times in 444 Posts
    Rep Power
    240
    +1 for Unlocker. Had to use it this very morning to clean up some corrupt profiles.

  8. Thanks to Hightower from:

    tech_guy (10th January 2011)

  9. #7

    tech_guy's Avatar
    Join Date
    May 2007
    Location
    That little bit in the middle of Little Old England
    Posts
    8,106
    Thank Post
    1,901
    Thanked 1,340 Times in 739 Posts
    Blog Entries
    3
    Rep Power
    394
    Great, thanks for that tip about Unlocker. The folders are now long gone. Mwahhahahaahaha.......

  10. #8

    bossman's Avatar
    Join Date
    Nov 2005
    Location
    England
    Posts
    3,853
    Thank Post
    1,160
    Thanked 1,028 Times in 729 Posts
    Rep Power
    323
    Another +1 for Unlocker also Delinvfile found here DelinvFile Download at LastDownload. Delete files with invalid names

    Enjoy

  11. 2 Thanks to bossman:

    mattx (10th January 2011), tech_guy (10th January 2011)

  12. #9

    Join Date
    Nov 2010
    Location
    Lincolnshire
    Posts
    57
    Thank Post
    16
    Thanked 2 Times in 2 Posts
    Rep Power
    8
    I know this is an old thread but i just found it. I had the same problem as the OP and Unlocker worked perfect! Thanks

  13. #10


    Join Date
    Feb 2007
    Location
    51.405546, -0.510212
    Posts
    8,125
    Thank Post
    203
    Thanked 2,390 Times in 1,770 Posts
    Rep Power
    704
    Quote Originally Posted by tech_guy View Post
    the folder name ends with a space.
    I had exactly the same issue recently after some Mac users created folders that had spaces and question marks at the end which Windows didn't like. I used the script below to strip out every single illegal character from all files and sub-folders contained within a folder.

    fix_filenames.pl
    Code:
    #!/usr/bin/perl -w
    
    # This script renames all the files supplied as command-line args
    # where necessary so that the filename is acceptable to MS Windows
    # Cameron Hayne (macdev@hayne.net), June 2004
    # http://hintsforums.macworld.com/showthread.php?t=25080
    
    use strict;
    
    chomp @argV = <STDIN>) unless @argV;
    
    # The Microsoft document at: http://support.microsoft.com/kb/100108
    # says that the following characters are not allowed in filenames in each of 
    # the specified file-systems:
    # FAT:   .  "  /  \  [  ]  |  :  ;  ,  =
    # NTFS:  ?  "  /  \  <  >  |  :  *
    
    # We don't do anything with the dot (.) since it clearly is allowable in spite 
    # of what that document says.
    # And we don't do anything with the slash (/) since that character will not 
    # occur in OS X file names and modifying it would cause troubles when a file 
    # path (with directories) is specified.
    # The changing of the filenames is done via the 'tr' statements below.
    # Each occurrence of a character in the first curly brackets is replaced by the
    # character in the second curly brackets.
    
    foreach my $filename  @argV)
    {
        my $orig_filename = $filename;
    
        $filename =~ tr{\\}{-};
        $filename =~ tr{*?}{X};
        $filename =~ tr{"><[]|:;,=}{_};
    
        unless ($filename eq $orig_filename)
        {
        print "About to rename $orig_filename to $filename\n";
        if (-e $filename)
        {
            print "Oops, there already exists a file named $filename\n";
            print "Skipping the rename - you will have to do it manually\n";
        }
        else
        {
            rename($orig_filename, $filename);
        }
        }
    }
    To run it, open Terminal on a Mac, make the script executable (chmod +x ~/Desktop/fix_filenames.pl), cd to the folder above the one you want to strip the illegal characters from and then run the command below.

    Code:
    find -d . -print0 | xargs -0 ~/Desktop/fix_filenames.pl

SHARE:
+ Post New Thread

Similar Threads

  1. Delete folders with exceptions
    By GlennOwens in forum Windows Server 2000/2003
    Replies: 2
    Last Post: 14th December 2010, 07:48 AM
  2. vb script to delete sub folders
    By ful56_uk in forum Scripts
    Replies: 1
    Last Post: 30th April 2010, 10:46 PM
  3. [CLOSED] Layout Issue: A lot of blank space at the end of threads....
    By elsiegee40 in forum EduGeek.net Site Problems
    Replies: 4
    Last Post: 19th April 2010, 07:59 PM
  4. Home Folders, Offline Files and Folder Names
    By Nick_Parker in forum Windows
    Replies: 22
    Last Post: 1st October 2009, 11:42 AM
  5. Script to delete certain folders
    By Pumaedition in forum Scripts
    Replies: 4
    Last Post: 22nd April 2008, 10:08 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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