LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-22-2016, 06:57 AM   #1
jheengut
Member
 
Registered: Sep 2006
Location: Providence, Moka Mauritius
Distribution: Slackware, Lubuntu
Posts: 315
Blog Entries: 16

Rep: Reputation: 47
Help me into how to change directory into a non-alphanumeric named folder


how to change directory into a non-alphanumeric typed folder
Code:
ls -a|cat -A
.$
..$
Services.xlsx$
System Volume Information$
M-BM- $
The last folder cannot be typed in using a keyboard.

Is there a way to change the folder name?
 
Old 04-22-2016, 07:38 AM   #2
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Quote:
Originally Posted by jheengut View Post
how to change directory into a non-alphanumeric typed folder
Code:
ls -a|cat -A
.$
..$
Services.xlsx$
System Volume Information$
M-BM- $
The last folder cannot be typed in using a keyboard.

Is there a way to change the folder name?
?

Do you mean the directory:
"M-BM- "

Why can't you type that? Use \ before a blank space. Like this:
Code:
cd M-BM-\
To rename it:
Code:
mv M-BM\ / foo
Or am I missing something?

Best regards,
HMW

Last edited by HMW; 04-22-2016 at 07:41 AM.
 
Old 04-22-2016, 10:50 AM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,445
Blog Entries: 13

Rep: Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762
Given that M-BM-<whatever> is unique from the other directory names, also use a wildcard:
Code:
mv M-BM-* <new-name>

Last edited by rtmistler; 04-22-2016 at 01:36 PM.
 
Old 04-22-2016, 11:04 AM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Since there are no "folders" in Linux. (They are all files.)
"Folders" is a graphical term for files...why not just deal with it graphically?

Last edited by Habitual; 04-24-2016 at 10:02 AM.
 
1 members found this post helpful.
Old 04-22-2016, 01:17 PM   #5
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
mc from the command line can often deal with weird file/directory names that are difficult to type.
 
1 members found this post helpful.
Old 04-22-2016, 01:32 PM   #6
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,242
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
Does
Code:
cd M-<tab>
not work?
 
2 members found this post helpful.
Old 04-22-2016, 01:38 PM   #7
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,445
Blog Entries: 13

Rep: Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762Reputation: 3762
Quote:
Originally Posted by lazydog View Post
Does
Code:
cd M-<tab>
not work?
This is along the lines of my recommendation. That name appears to be unique, use the wildcard or TAB for completion and then change the name to something which is not a problem.
Quote:
Originally Posted by Habitual View Post
Since there are no "folders" in Linux. (They are all files.)
"Folders" is a graphical term for files...why not just deal with graphically?
I also was thinking this too. Just in whatever form of file manager there is, right click, rename, ... boom, done

I guess it boils down to if there's something left out by the OP that we're missing here.
 
1 members found this post helpful.
Old 04-22-2016, 01:42 PM   #8
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US( + travel,) Earth( I wish,) END BORDER$!◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that works well on my cheapest; has been KDE or CLI but open... http://goo.gl/NqgqJx &c ;-)
Posts: 3,875
Blog Entries: 2

Rep: Reputation: 1319Reputation: 1319Reputation: 1319Reputation: 1319Reputation: 1319Reputation: 1319Reputation: 1319Reputation: 1319Reputation: 1319Reputation: 1319
Who may only have a CLI (like me 10% of the time:)
...quotes may help?
Code:
cd "M-BM- "
Have fun!

Last edited by jamison20000e; 04-22-2016 at 01:44 PM.
 
Old 04-22-2016, 04:45 PM   #9
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by rtmistler View Post
I guess it boils down to if there's something left out by the OP that we're missing here.
And there's always "more" to the story than some 20 some-odd word post.

System Volume Information$ is certainly a big "tell".

Last edited by Habitual; 04-22-2016 at 04:46 PM.
 
1 members found this post helpful.
Old 04-26-2016, 07:37 AM   #10
jheengut
Member
 
Registered: Sep 2006
Location: Providence, Moka Mauritius
Distribution: Slackware, Lubuntu
Posts: 315

Original Poster
Blog Entries: 16

Rep: Reputation: 47
Hi guys,

Sorry to be a bit late.

the output of ls gives just some folder name some are printable while one is not printable on the terminal .

But if I pipe the output of ls into cat -A, the non-printable characters' of the file name is output as

Code:
M-BM- $
This file name cannot be typed in using a normal keyboard and I forgot to get the hexadecimal number of the non-printable characters.

Still I managed to use nautilus in a ubuntu virtual machine to rename the folder.

The weird name arose due to a virus on a crappy windows shitty laptop. It managed to hide some files into a non-printable folder.
Even power shell was unable to print the filename.
Unfortunately, My slackbox was not with me at that particular place and time.
 
Old 04-26-2016, 09:01 AM   #11
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,230

Rep: Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724
You could manipulate directory file with inode number instead of name
find the inode number
Code:
ls -i
Then rename the directory using find
Code:
find . -maxdepth 1 -inum $inode_number -exec mv '{}' "new directory name" \;
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot change directory/folder in SCRIPT GONMAN1 Linux - Newbie 3 09-10-2015 02:39 AM
Incrontab Directory Change (watched Folder = Mounted FTP Account) kunalks Linux - Software 2 05-25-2015 12:18 PM
find specific named directory while excluding specific named directory sharky Linux - Newbie 6 01-17-2014 12:29 PM
Removing folder named ~ inside directory red_ifo Linux - Newbie 5 09-16-2013 01:42 PM
shell script: delete all directories named directory.# except directory.N brian0918 Programming 3 07-13-2005 07:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration