Special Characters in directory name

Hi all,

I've got a couple of directorys with special chars in the name:

# ls -q
personnel?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D?[D

unilive_?[B?[H?[L?[F?[L?[L?[Lpwd

I do not know how to get into these directorys to check if anything is their before deleting. Also I do not know ho wto delete these directorys.

Any help would be greatful!

Cheers

To help determine what the characters are, I would use the '-b' option with ls.

       -b, --escape
              print octal escapes for nongraphic characters

For filenames with special characters, I think it's easiest to use a typeglob. Do you have any other files that start with "personnel"? If not,

cd personnel*

would probably place you in that directory. Then just use 'ls' to see if it has files.

rmdir personnel*

would attempt to delete the directory, and would complain if it contained any files. Just make sure you don't have any other directories that start with "personnel".

Unfortunatly I do have another folder called personnel hence cannot do rmdir personnel*

ls -b
personnel\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D\033[D

Do you have Perl? Something like this might work. You would have to uncomment the rmdir line, but I would recommend this only after you know it's printing only the directory name you want to delete.

#!/usr/bin/env perl

my @files = glob("personnel*");

# 27 decimal = 33 octal
$char = sprintf("%c",27);

foreach $file ( @files ) {
   if ( $file =~ m/personnel$char/ ) {
     printf "dir = $file\n";
     # rmdir $file;
   }
}

I'm sure there's a way to escape octal characters in the shell, but I'm not sure how. Another alternative would be to move off all the 'normal' directories to a temporary location until the only one left is the "personnel\033[D.." file. Then rmdir personnel* as above.

Unfortuantly we do not have perl and the personnel directory is in constant use so cannot rename.

Any other ideas would be appreciated.

May be it will help you.....just put a double quote to escape the octals....

rmdir "dir/asdasdasdasa\asdalsdada/withlongname"

regards
Apoorva Kumar

tez,
The easiest way to remove it is to do a rm -ri personnel*, this should prompt you for every file/directory, find if there is anything in the directory, just use find, ie if there is not much in the parent directory just do a find . -print.