Find the answer to your Linux question:
Results 1 to 2 of 2
Good day! Somehow there is a directory w/ octal characters and other weird characters in a directory on my server: fermulator@fermmy-server:/media/disks/my_directory$ ls -al | grep PACK drwxrwx---+ 2 www-data www-data ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2005
    Posts
    54

    Question [SOLVED] Octal and other weird characters in a directory path


    Good day!

    Somehow there is a directory w/ octal characters and other weird characters in a directory on my server:

    fermulator@fermmy-server:/media/disks/my_directory$ ls -al | grep PACK
    drwxrwx---+ 2 www-data www-data 4096 2009-12-06 15:05 ����������������Ѫ���ӡ�PACK-����Ӱ�Ӹ��巢���
    I did some reading and apparently this might be octal characters ... ok, use ls w/ "-b":

    fermulator@fermmy-server:/media/disks/my_directory$ ls -alb | grep PACK
    drwxrwx---+ 2 www-data www-data 4096 2009-12-06 15:05 \241\266\271\376\300\373\241\244\262\250\314\330\3 23\353\273\354Ѫ\315\365\327ӡ\267PACK-\310\313\310\313Ӱ\312Ӹ\337\307巢\262\274\327\351
    If I try to CD into it w/ or w/out the escaped octal characters, it says "no such file or directory".

    fermulator@fermmy-server:/media/disks/my_directory$ cd "\241\266\271\376\300\373\241\244\262\250\314\330\ 323\353\273\354Ѫ\315\365\327ӡ\267PACK-\310\313\310\313Ӱ\312Ӹ\337\307巢\262\274\327\351"
    -bash: cd: \241\266\271\376\300\373\241\244\262\250\314\330\3 23\353\273\354Ѫ\315\365\327ӡ\267PACK-\310\313\310\313Ӱ\312Ӹ\337\307巢\262\274\327\351: No such file or directory
    fermulator@fermmy-server:/media/disks/my_directory$ cd "����������������Ѫ���ӡ�PACK-����Ӱ�Ӹ��巢���"
    -bash: cd: ����������������Ѫ���ӡ�PACK-����Ӱ�Ӹ��巢���: No such file or directory


    Any idea how to rename this directory to regular characters? It contains files I need.

  2. #2
    Just Joined!
    Join Date
    Jan 2005
    Posts
    54
    Thanks to fox2k for the tip!

    SOLUTION -- using "find" does the trick!

    # the following script searches in the "my_directory" for all files, filters to the "PACK" file with all those weird characters. Since find by default is recursive, it was able to see inside the "crazy" directory, and also list all those files, so I filtered again for the "file_i_need", and moved it to the temp dir!

    mkdir temp_PACK
    for file in $(find . | grep PACK | grep file_i_need); do echo $file; mv $file temp_pack; done

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •