mIRC Homepage
Posted By: SteeleR $remove - 02/02/06 09:37 AM
/remove filepath ... deletes a file .. but my filepath contains spaces ... what to replace them with ?

10x!
Posted By: FiberOPtics Re: $remove - 02/02/06 09:52 AM
/remove "filepath"
Posted By: SteeleR Re: $remove - 02/02/06 10:08 AM
10x smile
Posted By: bwr30060 Re: $remove - 02/02/06 04:07 PM
My mIRC directory contains a space and I haven't had problems with it so far, but just to be sure (or if you've had problems) the quotes should do it. Nice user name, by the way! wink Go Steelers.
Posted By: FiberOPtics Re: $remove - 02/02/06 04:10 PM
The path of your mIRC is irrelevant, it's the filepath that you specify with /remove that matters. In case of a space it will error or cause unexpected results.

Try: //write "a b.txt" | remove a b.txt

--> * /remove: no such file 'D:\mIRC\a'

With the quotes you will get a nice:

--> * Removed 'D:\mIRC\a b.txt'

Of course, if you actually had a file named "a" it would also have said it removed it, but it's clear we didn't want this in the first place. Note that although using quotes works, it will still fail on filepaths with multiple consecutive spaces.
Posted By: hixxy Re: $remove - 02/02/06 07:25 PM
Some commands that accept only a file/directory argument don't require quotes while others do.

/splay, /run - not required.
/mkdir, /rmdir, /remove - required.

I wish they were made required for all or none so the language was more consistent.
Posted By: FiberOPtics Re: $remove - 02/02/06 08:25 PM
Imo it would make sense to only use quotes in those cases where ambiguity can arise between the filepath, and any other parameters following the filepath.

Fex /remove only needs to take a filepath, so there I think it would be justified not to have to specify quotes, as the parser just needs to take $1- (or $2- if you specified the b flag)

In other cases, such as /write for example, there is no choice really, you can't do anything else but use quotes as write takes an optional third parameter (the text to be written). Without quotes it would be impossible to know where the filename stops and the text to write begins, in case the filepath contains spaces. $shortfn isn't an option, because it only works on files that exist, whilst /write doesn't necessarily need an existing file to write to.

On another topic, I think multiple consecutive spaces shouldn't be stripped in commands that are related to files/folders, where the filepath is in between quotes. As it stands, it's not possible to write to a file that has two consecutive spaces, nor is it possible to read from them, because even $read needs to be passed to some sort of command, which then strips consecutive spaces. Atleast not without using ugly hacks like $read($replace(a??b.txt,?,$chr(32)))
© mIRC Discussion Forums