Re: [SLUG] Escaping illegal characters in filenames - how?

2010-10-07 Thread DaZZa
On Thu, Oct 7, 2010 at 4:55 PM, Chris Donovan alienreside...@gmail.com wrote:
 So the command could be mv ./-.mxf newname.mxf.

 Another way that you may find handy in the future when using system
 utilities is the -- argument eg: rm -- -filname.  The example
 removes the file -filename.  The argument -- often signifies end of
 arguments, and anything after that is translated as non-arguments to
 the command.  It's used quite a bit in GNU tools, and I'd guess maybe
 more tools.

Thanks to those who replied so promptly.

Clue has been restored to mental processes, and perhaps most
importantly, (l)user has been attacked with seriously large clue stick
and told to not do it again!

DaZZa
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Escaping illegal characters in filenames - how?

2010-10-07 Thread Troy Rollo
On Friday 08 October 2010 08:03:32 DaZZa wrote:
 perhaps most
 importantly, (l)user has been attacked with seriously large clue stick
 and told to not do it again!

Why? The only illegal characters in file names on a UNIX or Linux file system 
(including ext2 and ext3) are the forward slash (because it is the path 
separator) and NUL (because it is the string terminator). Everything else is 
perfectly legitimate to use (including having a file named -rf *, which would 
only catch a very careless remover of the file)

-- 

Regards, 
Troy Rollo 
Solicitor 
Parry Carroll 
Commercial Lawyers 
Direct: (02) 8257 3177 
Fax: (02) 9221 1375 
Switch: (02) 9221 3899 
E-mail: t...@parrycarroll.com.au 
Web: www.parrycarroll.com.au 

Liability limited by a scheme approved under Professional Standards 
Legislation 

This message and any attachments are confidential to Parry Carroll. If you 
have received it my mistake, please let us know by reply and then delete it 
from your system. You must not copy the message, alter it or disclose its 
contents to anyone. Thank you.

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Escaping illegal characters in filenames - how?

2010-10-07 Thread DaZZa
On Fri, Oct 8, 2010 at 10:19 AM, Troy Rollo t...@parrycarroll.com.au wrote:
 On Friday 08 October 2010 08:03:32 DaZZa wrote:
 perhaps most
 importantly, (l)user has been attacked with seriously large clue stick
 and told to not do it again!

 Why? The only illegal characters in file names on a UNIX or Linux file 
 system
 (including ext2 and ext3) are the forward slash (because it is the path
 separator) and NUL (because it is the string terminator). Everything else is
 perfectly legitimate to use (including having a file named -rf *, which 
 would
 only catch a very careless remover of the file)

Because the over-lying system which interacts with the Unix filesystem
doesn't deal with filenames which begin with a -. it breaks essential
functionality when manipulating the files from the higher layer
program.

DaZZa
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Escaping illegal characters in filenames - how?

2010-10-07 Thread Troy Rollo
On Friday 08 October 2010 10:41:40 DaZZa wrote:

 Because the over-lying system which interacts with the Unix filesystem
 doesn't deal with filenames which begin with a -. it breaks essential
 functionality when manipulating the files from the higher layer
 program.

What program is that? I don't recall any serious program that could not deal 
rationally with such file names.
-- 

Regards, 
Troy Rollo 
Solicitor 
Parry Carroll 
Commercial Lawyers 
Direct: (02) 8257 3177 
Fax: (02) 9221 1375 
Switch: (02) 9221 3899 
E-mail: t...@parrycarroll.com.au 
Web: www.parrycarroll.com.au 

Liability limited by a scheme approved under Professional Standards 
Legislation 

This message and any attachments are confidential to Parry Carroll. If you 
have received it my mistake, please let us know by reply and then delete it 
from your system. You must not copy the message, alter it or disclose its 
contents to anyone. Thank you.

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Escaping illegal characters in filenames - how?

2010-10-07 Thread James
On Friday 08 October 2010 09:00:03 slug-requ...@slug.org.au wrote:
  perhaps most
  importantly, (l)user has been attacked with seriously large clue stick
  and told to not do it again!
 
 Why? The only illegal characters in file names on a UNIX or Linux file
 system  (including ext2 and ext3) are the forward slash (because it is the
 path separator) and NUL (because it is the string terminator). Everything
 else is perfectly legitimate to use (including having a file named -rf
 *, which would only catch a very careless remover of the file)

The nice thing with vi is that it is predictable and consistant
ie you want the date in a document and have never done that before so yo do
:r !date
(read the output of the command 'date', and you can predict that)

Likewise -- as an argument says no further options so
mv -- -fr zot
renames the file '-fr' to zot
cp -- zot -fr
copies zot to -fr
rm -- -fr zot
removes file '-fr' and file 'zot'

rm -fr zot will recursivly remove directory zot even if the files in it are 
read only! so do beware

James
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] Escaping illegal characters in filenames - how?

2010-10-06 Thread DaZZa
Folks.

I've got an idiot user who has created a file on a Linux filesystem named

-.mxf

I need to rename this file, but can't for the life of me remember how
to escape the - character so mv doesn't regard it as an option
identifier.

Can someone apply the cluestick, please?

DaZZa
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Escaping illegal characters in filenames - how?

2010-10-06 Thread Amos Shapira
On 7 October 2010 16:44, DaZZa dagi...@gmail.com wrote:
 Folks.

 I've got an idiot user who has created a file on a Linux filesystem named

 -.mxf

 I need to rename this file, but can't for the life of me remember how
 to escape the - character so mv doesn't regard it as an option
 identifier.

Insert ./ in front of it so mv doesn't see the - at the beginning
of the string and tries to interpret it as a flag.

So the command could be mv ./-.mxf newname.mxf.

--Amos
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Escaping illegal characters in filenames - how?

2010-10-06 Thread Owen Townend
On 7 October 2010 16:44, DaZZa dagi...@gmail.com wrote:
 Folks.

 I've got an idiot user who has created a file on a Linux filesystem named

 -.mxf

 I need to rename this file, but can't for the life of me remember how
 to escape the - character so mv doesn't regard it as an option
 identifier.

 Can someone apply the cluestick, please?

 DaZZa

Hey,
From the rm man page:
   To remove a file whose name starts with a `-', for example `-foo', use 
 one of these commands:
 rm -- -foo
 rm ./-foo

$ rm -- -.mxf

Cheers,
Owen.
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Escaping illegal characters in filenames - how?

2010-10-06 Thread Chris Donovan
 I've got an idiot user who has created a file on a Linux filesystem named

 -.mxf

 I need to rename this file, but can't for the life of me remember how
 to escape the - character so mv doesn't regard it as an option
 identifier.

 Insert ./ in front of it so mv doesn't see the - at the beginning
 of the string and tries to interpret it as a flag.

 So the command could be mv ./-.mxf newname.mxf.

Another way that you may find handy in the future when using system
utilities is the -- argument eg: rm -- -filname.  The example
removes the file -filename.  The argument -- often signifies end of
arguments, and anything after that is translated as non-arguments to
the command.  It's used quite a bit in GNU tools, and I'd guess maybe
more tools.

Chris-
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Escaping illegal characters in filenames - how?

2010-10-06 Thread Andrew Bennetts
DaZZa wrote:
 Folks.
 
 I've got an idiot user who has created a file on a Linux filesystem named
 
 -.mxf
 
 I need to rename this file, but can't for the life of me remember how
 to escape the - character so mv doesn't regard it as an option
 identifier.
 
 Can someone apply the cluestick, please?

mv -- -.mxf foo.mxf

-Andrew.

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html