Closed Thread Icon

Preserved Topic: deleting files w/ special characters (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=20914" title="Pages that link to Preserved Topic: deleting files w/ special characters (Page 1 of 1)" rel="nofollow" >Preserved Topic: deleting files w/ special characters <span class="small">(Page 1 of 1)</span>\

 
JKMabry
Maniac (V) Inmate

From: out of a sleepy funk
Insane since: Aug 2000

posted posted 05-21-2001 05:04

Can somebody tell me how to delete a file off an Apache server that has a tilde (~) in the file name? I ran across this info the other day but since I didn't need it at the time, I forgot, now I can't find the spot that I saw it!

thanks

Jason

linear
Paranoid (IV) Inmate

From: other places
Insane since: Mar 2001

posted posted 05-21-2001 05:18

You can shell escape it: rm \~foo
or use a glob: rm ?foo



JKMabry
Maniac (V) Inmate

From: out of a sleepy funk
Insane since: Aug 2000

posted posted 05-21-2001 06:28

complete and utter Greek to me, but thanks anyhow

I feel a bit tarded saying this, but I'm a clicker as opposed to a command liner. hep, whimper...

Jason

taxon
Neurotic (0) Inmate
Newly admitted
posted posted 05-21-2001 06:33

you can also use the ?no\~cloo command line.



kat
Paranoid (IV) Inmate

From: memphis TN
Insane since: Apr 2001

posted posted 05-21-2001 06:56

hehe ...

well...

you can use php to opendir("."); that's got the ~ file in it

code:
<?php

$dir = opendir(".");
while($filename = readdir($dir)) {
if (preg_match("/~/",$filename)) {
unlink $filename;
}
}
closedir($dir);

?>



try that ?


{ kat ; mmm.. a site! }

JKMabry
Maniac (V) Inmate

From: out of a sleepy funk
Insane since: Aug 2000

posted posted 05-21-2001 07:10

when they call me a geek at work I'm gonna point them to this thread k?

Jason

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 05-21-2001 07:49

JK, this is nothing, heh! You have to see some real geek stuff...

linear
Paranoid (IV) Inmate

From: other places
Insane since: Mar 2001

posted posted 05-21-2001 15:45

Under Unix-like operating systems:

Your shell will expand ~ into your home directory. So that's why tilde is a special character. You tell the shell not to perform the expansion by preceding the tilde with a backslash (escaping it).

The question mark is a wildcard that will match any character (just like DOS), so you can use it the way you'd place a blank tile in Scrabble.

Since tilde doesn't have any special mojo under other OS's, I figured you were asking essentially how to stop the shell from expanding the tilde.

JKMabry
Maniac (V) Inmate

From: out of a sleepy funk
Insane since: Aug 2000

posted posted 05-21-2001 15:52

Scrabble?!?!
Super - geeks

you guys are wonderful, I appreciate the help. I'm sure I can figure this one out with the info provided, couldn't resist giving you a hard time though. I actually got a freebie shell account once with the intention of learning that stuff but it was so ugly and boring I lost interest really fast. I did like the blinking cursor tho, heh...

maX: I know this is nothing, I fear what you could show me...

Jason

« BackwardsOnwards »

Show Forum Drop Down Menu