- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: delete files with filename starting with speci...
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
03-16-2001 01:12 AM
03-16-2001 01:12 AM
delete files with filename starting with special characters
I've forgot how to delete files with filename starting with special characters. In particular, starting with "-" char.
thanks in advance
regards Davide
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2001 01:30 AM
03-16-2001 01:30 AM
Re: delete files with filename starting with special characters
substitute the inode number in place of the # below; (be very careful with the syntax, it must be exactly correct)
find . -xdev -inum # -exec ll {} \;
find . -xdev -inum # -exec rm -i {} \;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2001 01:32 AM
03-16-2001 01:32 AM
Re: delete files with filename starting with special characters
You can simply specify full path to file
for example
rm /tmp/-xxx
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2001 01:32 AM
03-16-2001 01:32 AM
Re: delete files with filename starting with special characters
Instead of "rm -abc" use "rm ./-abc".
Thomas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2001 02:38 AM
03-16-2001 02:38 AM
Re: delete files with filename starting with special characters
I once saw an experienced sysadmin delete a file named "*" with "rm *". Well he succeeded, the file was gone ;)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2001 02:53 AM
03-16-2001 02:53 AM
Re: delete files with filename starting with special characters
set -o vi
You can use the quote
rm "
then ESC
the cursor will move back a space
then =
to get a list of the files
You can then type the first letter
and ESC ESC to get the shell to
continue the file name.
This is real usefull for strange characters
at the end of the filename as well.
I recall once that some of these files with special characters don't show up on a quota?
Although I could be wrong about that.
Bill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2001 03:03 AM
03-16-2001 03:03 AM
Re: delete files with filename starting with special characters
OK, second try :
When deleting files with special characters by using wildcards I would really encourage you to use "rm -i". Play is safe!
I one saw an experience sysadmin delete a file named "*" with "rm *". Well he succeeded, the file was gone ;)
regards,
Thierry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2001 05:29 AM
03-16-2001 05:29 AM
Re: delete files with filename starting with special characters
Thierry is right, play it safe use "rm -i *". This will help you on delete the file using interactive mode of yes/no. You just have to be careful in using the command.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2001 07:18 AM
03-16-2001 07:18 AM
Re: delete files with filename starting with special characters
How about deleting a file "-R*" in the / dir ?
People will try to catch you out so -i should become a habit.
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2001 08:30 AM
03-16-2001 08:30 AM
Re: delete files with filename starting with special characters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2001 08:32 AM
03-16-2001 08:32 AM
Re: delete files with filename starting with special characters
Later,
Bill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2001 08:47 AM
03-16-2001 08:47 AM
Re: delete files with filename starting with special characters
never deal with wildcards in this case !
Use "ftp localhost" and delete by exactly
typing the name. ftp does not expand wildcards.
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2001 10:41 AM
03-16-2001 10:41 AM
Re: delete files with filename starting with special characters
refer to it is to use the "--" option, which most commands
support (see "man 3 getopt"). To delete a file called '-i',
you'd say "rm -- -i". The "--" option tells the command
that all subsequent arguments are filenames and not
options.
For other shell special characters like '*', '$', '!', ' ' (space),
etc., just enclose the filename in single quotes; the "--"
and "./" techniques won't work for that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2001 04:23 AM
04-22-2001 04:23 AM
Re: delete files with filename starting with special characters
Ciao, scuzzarmi di mia scriatura.
Begoigno di dari punti a le resposto che tutti di addatto.
Grazie,
Nickd
_____
Translation
Hello,
Pardon my Italian writing.
One should assign points or review replies that everyone posts to your question.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2001 07:34 AM
04-22-2001 07:34 AM
Re: delete files with filename starting with special characters
Rob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2001 11:53 AM
04-22-2001 11:53 AM
Re: delete files with filename starting with special characters
http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0xa78d0cb17a32d5118fef0090279cd0f9,00.html
Too bad people aren't assigning points...we're going to lose the value of this site.