mIRC Home    About    Download    Register    News    Help

Print Thread
$remove #140992 02/02/06 09:37 AM
Joined: Sep 2004
Posts: 73
S
SteeleR Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Sep 2004
Posts: 73
/remove filepath ... deletes a file .. but my filepath contains spaces ... what to replace them with ?

10x!


HanPeg HanPeg u BuHaru HanPeg nPu noPa}|{eHue kParoM u nAk HanPeg
Re: $remove #140993 02/02/06 09:52 AM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
/remove "filepath"


Gone.
Re: $remove #140994 02/02/06 10:08 AM
Joined: Sep 2004
Posts: 73
S
SteeleR Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Sep 2004
Posts: 73
10x smile


HanPeg HanPeg u BuHaru HanPeg nPu noPa}|{eHue kParoM u nAk HanPeg
Re: $remove #140995 02/02/06 04:07 PM
Joined: May 2005
Posts: 449
bwr30060 Offline
Fjord artisan
Offline
Fjord artisan
Joined: May 2005
Posts: 449
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.

Re: $remove #140996 02/02/06 04:10 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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.


Gone.
Re: $remove #140997 02/02/06 07:25 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
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.

Re: $remove #140998 02/02/06 08:25 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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)))


Gone.