- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: I have a file name named ? and I can't delete ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 06:56 AM
01-09-2002 06:56 AM
I have a file name named ? and I can't delete it!
Thanks,
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 06:59 AM
01-09-2002 06:59 AM
Re: I have a file name named ? and I can't delete it!
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 07:01 AM
01-09-2002 07:01 AM
Re: I have a file name named ? and I can't delete it!
You can escape the "?" with "\":
# rm -i filename\?
...or...
Using the interactive option of 'rm' and wildcards, respond "y" or "n" appropriately:
# rm -i file*
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 07:03 AM
01-09-2002 07:03 AM
Re: I have a file name named ? and I can't delete it!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 07:05 AM
01-09-2002 07:05 AM
Re: I have a file name named ? and I can't delete it!
find . -type f -name ? -exec rm {} \;
GL,
C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 07:08 AM
01-09-2002 07:08 AM
Re: I have a file name named ? and I can't delete it!
rm "?"
rm '?'
rm \?
rm "\?" will only remove a file called \?
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 07:19 AM
01-09-2002 07:19 AM
Re: I have a file name named ? and I can't delete it!
Actually, if the file is named ? it will be removed with: rm ?
Unfortunately, so will all other 1 character named files.
I'm sure you probably meant that you shouldn't use rm ? because it could delete other files as well.
For the find suggestion you need to quote and escape ? like so:
find . -name "\?"
Without quoting it will error. Without escaping it will act as a wildcard.
Use John's suggestions. And when in doubt, include the -i option to be safe.
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 07:22 AM
01-09-2002 07:22 AM
Re: I have a file name named ? and I can't delete it!
#rm \?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 07:23 AM
01-09-2002 07:23 AM
Re: I have a file name named ? and I can't delete it!
#rm \?
or
# mv \? x
#rm x
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 08:18 AM
01-09-2002 08:18 AM
Re: I have a file name named ? and I can't delete it!
Try this,
cd to the directory where this file is present,
do a
# ls >test_file
edit "test_file" and remove all entries other than the file you want to remove.
insert and "rm " before the file name and then run this file,
# sh test_file
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 08:24 AM
01-09-2002 08:24 AM
Re: I have a file name named ? and I can't delete it!
I make a new directory (for security reasons)and then I move it the file first to this, then I tried to rm \?.
Regards,
Justo.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2002 10:50 AM
01-09-2002 10:50 AM
Re: I have a file name named ? and I can't delete it!
cd where file is
ls -i (lists all file #'s)
find . -inum <#from above> -exec rm {} \;
Rgrds,
Rita
..because in UNIX we have so many ways to do the same thing !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2002 03:31 AM
01-10-2002 03:31 AM
Re: I have a file name named ? and I can't delete it!
Just use the following command :
# rm "?"
and your file will be deleted.
Magdi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2002 03:08 AM
01-11-2002 03:08 AM
Re: I have a file name named ? and I can't delete it!
rm [-i] ./?
I.e. dot+slash+difficult_character(s) also works when, for example, the file has a leading minus sign (which rm(1) will interpret as an option, but the dot+slash prevents that).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2002 03:37 AM
01-11-2002 03:37 AM
Re: I have a file name named ? and I can't delete it!
If your 'difficult filename' starts with a - then another solution is:
rm [-i] --
where -- terminates the list of command options. This works for every command that uses getopt(3C) for analysing its arguments (most do).
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2002 03:48 AM
01-11-2002 03:48 AM
Re: I have a file name named ? and I can't delete it!
Try
set noglob
mv \? notwanted
ll notwanted
If ok
rm notwanted
Steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2002 05:01 AM
01-11-2002 05:01 AM
Re: I have a file name named ? and I can't delete it!
> rm ./? will still remove every file in the current directory.
It will only remove every file which has a *single-character* name (but *not* "."). But since these might exist, I said "[-i]", didn't I? :-) I assume(d) that the poster knew what "?" meant, because he said that it was a wildcard.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2002 02:20 AM
01-14-2002 02:20 AM
Re: I have a file name named ? and I can't delete it!
does the filename really contain 1 character?? In my experience files listed with "?" mostly contain some escape codes.
so does "ls ?", "ls ??", ls "???", ls "????", ... show the file ???
when found, remove with "rm -i ???" or so.
To play safe, always add "-i" ;-)
good luck,
Thierry.