PC Review


Reply
Thread Tools Rate Thread

Delete filename with trailing space..

 
 
Jake
Guest
Posts: n/a
 
      26th Jan 2010
Help...

How do I delete a file / folder in XP which has a trailing space...?

regards jake
 
Reply With Quote
 
 
 
 
Andrew McLaren
Guest
Posts: n/a
 
      26th Jan 2010

On 26/01/2010 19:23, Jake wrote:

> How do I delete a file / folder in XP which has a trailing space...?



Hi Jake

Put quotes around the file name. For example from a command line:


C:\SOMEDIR>del "this is a file with a trailing space "

or

C:\>rmdir "this is a folder with a trailing space "


Note the trailing space, in these commands :-)

Hope it helps,

Andrew

--
amclar at optusnet dot com dot au
 
Reply With Quote
 
Pegasus [MVP]
Guest
Posts: n/a
 
      26th Jan 2010


"Jake" <(E-Mail Removed)> said this in news item
news:(E-Mail Removed)...
> Help...
>
> How do I delete a file / folder in XP which has a trailing space...?
>
> regards jake


AFAIK, Windows allows file or folder names with *embedded* spaces but not
with *trailing* spaces. How exactly did you work out that you had a name
with a trailing space?

 
Reply With Quote
 
a
Guest
Posts: n/a
 
      26th Jan 2010
"Pegasus [MVP]" <(E-Mail Removed)> wrote

> AFAIK, Windows allows file or folder names with *embedded* spaces but not with *trailing* spaces.


Huh? Of course files and folders can have spaces at their start or end.

> How exactly did you work out that you had a name with a trailing space?


By seeing the blank space in the focus rectangle when selected.


 
Reply With Quote
 
Pegasus [MVP]
Guest
Posts: n/a
 
      26th Jan 2010


"a" <(E-Mail Removed)> said this in news item
news:4b5ecabc$(E-Mail Removed)...
> "Pegasus [MVP]" <(E-Mail Removed)> wrote
>
>> AFAIK, Windows allows file or folder names with *embedded* spaces but not
>> with *trailing* spaces.

>
> Huh? Of course files and folders can have spaces at their start or end.
>
>> How exactly did you work out that you had a name with a trailing space?

>
> By seeing the blank space in the focus rectangle when selected.


This can be deceptive. The white space could be $FF. It looks the same as a
space but it isn't.

 
Reply With Quote
 
Andrew McLaren
Guest
Posts: n/a
 
      26th Jan 2010
On 26/01/2010 21:37, Pegasus [MVP] wrote:
>> How do I delete a file / folder in XP which has a trailing space...?

> AFAIK, Windows allows file or folder names with *embedded* spaces but
> not with *trailing* spaces. How exactly did you work out that you had a
> name with a trailing space?


With respect ... actually, NTFS has no problem creating a file with a
trailing space in the name. However Windows Explorer, CMD.EXE and
OS-supplied utilities will usually trim any trailing spaces from a file
name when they manipulate a file. So, yes: a trailing space is rare. But
any app can decide to do:

hFile = CreateFile("My funnny file " // file name
<...> // other params
FILE_ATTRIBUTE_NORMAL, // normal file
NULL);

....and create a file with a trailing space in its name.

Trailing spaces are explicitly deprecated in the Windows SDK's file
naming convention guidelines; but there's nothing to actually stop
someone from doing it.

You are correct that the U+00A0 "No break space" char can also look like
a space, and is indeed legal at the end of file names.

Apologies for being a pedantic pain-in-the-butt, but ... I get all
pedantic, sometimes :-)

Cheers

Andrew

--
amclar at optusnet dot com dot au
 
Reply With Quote
 
Pegasus [MVP]
Guest
Posts: n/a
 
      26th Jan 2010


"Andrew McLaren" <(E-Mail Removed)> said this in news item
news:#(E-Mail Removed)...
> On 26/01/2010 21:37, Pegasus [MVP] wrote:
>>> How do I delete a file / folder in XP which has a trailing space...?

>> AFAIK, Windows allows file or folder names with *embedded* spaces but
>> not with *trailing* spaces. How exactly did you work out that you had a
>> name with a trailing space?

>
> With respect ... actually, NTFS has no problem creating a file with a
> trailing space in the name. However Windows Explorer, CMD.EXE and
> OS-supplied utilities will usually trim any trailing spaces from a file
> name when they manipulate a file. So, yes: a trailing space is rare. But
> any app can decide to do:
>
> hFile = CreateFile("My funnny file " // file name
> <...> // other params
> FILE_ATTRIBUTE_NORMAL, // normal file
> NULL);
>
> ...and create a file with a trailing space in its name.
>
> Trailing spaces are explicitly deprecated in the Windows SDK's file naming
> convention guidelines; but there's nothing to actually stop someone from
> doing it.
>
> You are correct that the U+00A0 "No break space" char can also look like a
> space, and is indeed legal at the end of file names.
>
> Apologies for being a pedantic pain-in-the-butt, but ... I get all
> pedantic, sometimes :-)


.. . . which goes to show that just because I am unable to do a certain thing
does not mean that it can't be done. Thanks for the clarification!


 
Reply With Quote
 
Jose
Guest
Posts: n/a
 
      27th Jan 2010
On Jan 26, 3:23*am, Jake <jak...@gmail.com> wrote:
> Help...
>
> How do I delete a file / folder in XP which has a trailing space...?
>
> regards jake


How did you determine that the file / folder has a trailing space, how
are you trying to delete it (Windows Explorer?), do you get any kind
of error message stating the attempt failed and if you do, what is the
message?
 
Reply With Quote
 
a
Guest
Posts: n/a
 
      27th Jan 2010
"Pegasus [MVP]" <(E-Mail Removed)> wrote
>>> AFAIK, Windows allows file or folder names with *embedded* spaces but not with *trailing* spaces.

>>
>> Huh? Of course files and folders can have spaces at their start or end.
>>
>>> How exactly did you work out that you had a name with a trailing space?

>>
>> By seeing the blank space in the focus rectangle when selected.

>
> This can be deceptive. The white space could be $FF. It looks the same as a space but it isn't.


It's not $FF, it's $20. I did it myself via my own application. (It was actually
a bug in my app that led to two filenames having a leading space, due to a bad
crop of their names).


 
Reply With Quote
 
John John - MVP
Guest
Posts: n/a
 
      27th Jan 2010
Jake wrote:
> Help...
>
> How do I delete a file / folder in XP which has a trailing space...?


At a command prompt:

del "\\?\c:\path_to_file_that contains a trailing space.txt "

To avoid path errors it's easier to grab the file with Windows Explorer
and then drop it at the command prompt, type the partial command:

del \\?\

then drop the grabbed file to the prompt. Pay attention to the path's
"quotation marks".

John
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
delete trailing space in column J.W. Aldridge Microsoft Excel Programming 6 27th Apr 2009 09:25 PM
Keep trailing space in field =?Utf-8?B?Um9iZXJ0X0xfUm9zcw==?= Microsoft Access Forms 17 12th Aug 2007 12:06 PM
Cannot delete Folder with trailing space =?Utf-8?B?U2Vhbg==?= Windows XP General 3 14th Jul 2006 02:47 AM
Remove trailing space NusratRahman@cs.com Microsoft Excel Worksheet Functions 5 17th May 2004 10:46 PM
Autotext without trailing space? Steve Sanford Microsoft Word New Users 6 23rd Jan 2004 02:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:33 PM.