LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 06-25-2009, 02:24 PM   #1
tikit
Member
 
Registered: Feb 2008
Posts: 84

Rep: Reputation: 16
filename containing a question mark


Hi,

I have a file named 'Movie ?04.cd1.avi'. I can neither open the file nor rename it. I always get "No such file or directory". I think the problem is the question mark it contains. Is there a way how to open or rename the file?

Thanks.
 
Old 06-25-2009, 02:33 PM   #2
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 620

Rep: Reputation: 33
Quote:
Originally Posted by tikit View Post
Hi,

I have a file named 'Movie ?04.cd1.avi'. I can neither open the file nor rename it. I always get "No such file or directory". I think the problem is the question mark it contains. Is there a way how to open or rename the file?

Thanks.
I think like you can escape a " " (space) with "\ ", you can also escape this question mark.

Code:
mv Movie\ \?04.cd1.avi Movie\ 04.cd1.avi
 
Old 06-25-2009, 02:49 PM   #3
tikit
Member
 
Registered: Feb 2008
Posts: 84

Original Poster
Rep: Reputation: 16
I tried this but it does not work. When I type Movie and press TAB, the rest of the filename is completed with the escaped characters, but I always get "No such file or directory"
 
Old 06-25-2009, 02:58 PM   #4
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 60
What shell do you use?
I don't think the problem is with the question mark, here it works nicely:

teddy@freakinwork ~$ touch "Movie ?04.cd1.avi"
teddy@freakinwork ~$ ls M*
Movie ?04.cd1.avi
teddy@freakinwork ~$ mv Movie\ \?04.cd1.avi Movie04.cd1.avi
teddy@freakinwork ~$ ls M*
Movie04.cd1.avi

You might have a problem with you filesystem. I would try checing it for consistency.
 
Old 06-25-2009, 03:01 PM   #5
nuwen52
Member
 
Registered: Feb 2009
Distribution: CentOS 5, Gentoo, FreeBSD, Fedora, Mint, Slackware64
Posts: 205

Rep: Reputation: 46
I was able to enclose the filename in "" (no backslash escapes) and that worked in a test.

mv "Movie ?04.cd1.avi" test.avi

Last edited by nuwen52; 06-25-2009 at 03:03 PM.
 
Old 06-25-2009, 03:17 PM   #6
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by tikit View Post
I tried this but it does not work. When I type Movie and press TAB, the rest of the filename is completed with the escaped characters, but I always get "No such file or directory"
Don't pressing TAB, you don't need to. Why would you use TAB, when you just need a few characters, a new filename, and a RETURN/ENTER. TAB completion is not really what you want, as of course, it keeps returning the last commands you gave it back to you.

Also, have you got the needed permissions to move/rename the file?

try: cp -ufv ./Mo* ./NewName

Hope I am understanding this issue correctly,
Uncle Theodore may be onto something, but his examples should work.

What type filesystem is the problem occurring on?

Sasha

Last edited by GrapefruiTgirl; 06-25-2009 at 03:22 PM.
 
Old 06-25-2009, 04:34 PM   #7
tikit
Member
 
Registered: Feb 2008
Posts: 84

Original Poster
Rep: Reputation: 16
Thanks for replies. It still does not work. I think it is a filesystem problem. This file is on Windows FAT mounted via CIFS. If I use
Code:
touch "Movie ?04.cd1.avi"
on an ext3 partition there is no problem.
 
Old 06-25-2009, 06:50 PM   #8
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
check=value
Three different levels of pickyness can be chosen:

r[elaxed]
Upper and lower case are accepted and equivalent, long name
parts are truncated (e.g. verylongname.foobar becomes very-
long.foo), leading and embedded spaces are accepted in each
name part (name and extension).

n[ormal]
Like "relaxed", but many special characters (*, ?, <, spaces,
etc.) are rejected. This is the default.

s[trict]
Like "normal", but names may not contain long parts and special
characters that are sometimes used on Linux, but are not
accepted by MS-DOS are rejected. (+, =, spaces, etc.)
The above is a quote out of the `mount` man page; I'm not familiar with CIFS but is it possible the default option setting for this mount option is causing the problem? Maybe mounting with check=relaxed option would get around it.

Sasha

EDIT - PS, this option is for FAT, by the way; I forgot to mention

Last edited by GrapefruiTgirl; 06-25-2009 at 06:53 PM. Reason: see EDIT
 
Old 06-26-2009, 12:38 PM   #9
tikit
Member
 
Registered: Feb 2008
Posts: 84

Original Poster
Rep: Reputation: 16
Many thanks. mount -o check=r did the trick.
 
  


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
Question Mark aemerick Linux - Server 1 03-30-2009 04:16 PM
Question Mark issue, please help. onlineusers1 Linux - Newbie 2 01-14-2008 07:05 PM
question mark and forward slash osc~ Slackware 2 08-16-2007 01:32 PM
Why does my penguin have a question mark? beejayzed General 5 03-23-2004 06:23 PM
iptables mark question paulos Linux - Networking 0 01-21-2004 08:20 AM


All times are GMT -5. The time now is 07:33 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration