- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Delete file with "-" character inside its name
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
08-02-2007 03:54 AM
08-02-2007 03:54 AM
I have (by accident) a file which name is:
-stats.tar.gz
How can I delete this file?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2007 03:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2007 03:56 AM
08-02-2007 03:56 AM
Re: Delete file with "-" character inside its name
try to escape the - char, like this:
#rm \-stats.tar.gz
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2007 03:58 AM
08-02-2007 03:58 AM
Re: Delete file with "-" character inside its name
Thank you to both.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2007 05:33 PM
08-03-2007 05:33 PM
Re: Delete file with "-" character inside its name
this would be another option:
find . -name "-test" -exec rm {} \;
e.g.
[root@server1 tmp]# cat /etc/hosts > '-test'
[root@server1 tmp]# ls
EM_TARGET_INSTALLER.lk ibm p2617419_10102_generic.zip -test tx.log
[root@server1 tmp]# find . -name "-test" -exec rm {} \;
[root@server1 tmp]# ls
EM_TARGET_INSTALLER.lk hp p2617419_10102_generic.zip tx.log
[root@server1 tmp]#
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2007 06:07 PM
08-03-2007 06:07 PM
Re: Delete file with "-" character inside its name
> find . -name "-test" -exec rm {} \;
And if you have a file like "./fred/-test",
and you don't want to delete _that_ one?
An unrestricted "find" is a pretty big hammer.