Re: Accented chars in filenames issue
lee <lee@yun.yagibdah.de> writes:
> You can just rename a file with:
>
> # mv 1307474391 "rm -rf *"
>
> ,----
> | lee@yun:~/tmp/naming$ ls -la
> | insgesamt 52
> | drwxr-xr-x 2 lee lee 4096 25. Jun 15:48 .
> | drwx------ 12 lee lee 32768 25. Jun 15:48 ..
> | -rw-r--r-- 1 lee lee 116 9. Jun 16:35 -rf
> | -rw-r--r-- 1 lee lee 94 7. Jun 21:19 rm -rf *
> | -rw-r--r-- 1 lee lee 94 7. Jun 21:17 rm -rf \*
> | -rw-r--r-- 1 lee lee 94 7. Jun 21:16 rm -rf 1307474137
> | lee@yun:~/tmp/naming$
> `----
>
> I haven't tried touch, it'll probably work the same. A nice application
> might be to provide "rm -rf *" as a filename for an attachment to an
> email?
>
> Now how to remove these files gives me something to think about very
> carefully ... :(
[cut from here]
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <error.h>
// the name of the file to be removed:
#define NAME "none"
int main(int argc, char *argv[] ) {
int ret;
int err;
ret = unlink(NAME);
err = errno;
if(ret) {
error(0, err, "unlinking '%s'", NAME);
}
else {
printf("'%s' successfully unlinked\n", NAME);
}
return ret;
}
[cut to here]
Save it as "removing.c", adjust the name of the file you want to remove
and run gcc -Wall -Os -o removing removing.c. Than run ./removing to
remove the file.
Reply to: