Unable to remove folder in linux


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Unable to remove folder in linux
# 1  
Old 08-27-2009
Unable to remove folder in linux

Hi

I am using red hat linux, In my folder a strange folder is created i.e. " -a " , folder name is preceded with hyphen. Now if i try to remove with rm -rf -1 , i am unable to do it.
Can anyone please let me know how to do it, & what this kind of folder means

Thanks
Sarbjit
# 2  
Old 08-27-2009
Code:
rm -r -- -a

# 3  
Old 08-27-2009
Thanks

Quote:
Originally Posted by radoulov
Code:
rm -r -- -a

It works.

Can you please tell me what that folder means? and the code you provided its explanation

Thanks
# 4  
Old 08-27-2009
Quote:
Originally Posted by sarbjit
It works.

Can you please tell me what that folder means? and the code you provided its explanation
I don't know what that folder means ...
The leading dash in the filename confuses the rm program so you need double-dash to indicate the end of the options.
From man rm on my Cygwin:

Code:
       To remove a file whose name starts with a `-', for example `-foo', use  one  of  these  com-
       mands:

              rm -- -foo

              rm ./-foo

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

Unable to access the CIFS share folder on windows by IP

Hi All Actually I have NAS Storage and Suddenly I got problem Unable to access the CIFS share folder on windows host, however the IP is pinging and the share is accessible via share name. The share can be accessed via share name only on Windows higher Windows Versions. Any help guys (4 Replies)
Discussion started by: Abu_SM
4 Replies

2. HP-UX

Unable to mount shared folder from Linux server

Hi all, I have 3 servers, rx2600, rx2600, and rx2660. I have another x86 server running on Suse, and create a shared folder named /public From 1 of the rx2600 server I can mount that shared folder : intaqa:/>mount 10.1.2.82:/public /bkup intaqa:/>cd /bkup But from 2 others server I... (29 Replies)
Discussion started by: rexmale
29 Replies

3. Shell Programming and Scripting

Remove folder contents

for dir in BKP/*/ do echo You are in :$dir done O/P -- BKP/201448/ BKP/201449/ BKP/201450/ BKP/201451/ BKP/201452/ BKP/201501/ BKP/201502/ BKP/201503/ BKP/201504/ BKP/201505/ BKP/201506/ BKP/201507/ (3 Replies)
Discussion started by: rocking77
3 Replies

4. UNIX for Dummies Questions & Answers

Unable to list folder contents

I'm unable to list the contents of a directory once I move into it. I have full permissions on this directory (called "Scripts" in the below example). The scenario is shown below in detail: Command 'ls' works fine to begin with: 1: pmn@linuxhost /home/pmn > cd /opt/smt/proiv 2:... (4 Replies)
Discussion started by: pmn
4 Replies

5. AIX

Unable to share win folder in AIX

Hi, Iam unable to share WInXp folder in AIX, i configured samba, its working fine, i am able to access win folder from AIX by using samba but unbale to access AIX folder from Windows. bash-3.00# mount -v cifs -n Win_IP/Win_username/Win_passwd /Win_Folder /AIX-folder Result: There was an... (1 Reply)
Discussion started by: mpasha06
1 Replies

6. Solaris

Unable to create folder as a user

Hi All, I am trying to create a folder in /export/home/user1 directory as a user1 but I am getting the error message as -bash-3.00$ mkdir abc mkdir: Failed to make directory "abc"; Permission denied Also I tried creating the folder but it fails too -bash-3.00$ touch abc touch: cannot... (2 Replies)
Discussion started by: Manjunath K V
2 Replies

7. Shell Programming and Scripting

Remove all folders within another folder except the lastest 1, 2 or 3.

I am using this command to remove all files and folders older than 24 hours; find /databackup/dbs/* -maxdepth 0 -type d -mtime +0 -exec rm -rf {} \; However, if/when backups to this folder fail and are not updated, it will completely destroy any backups we have in that folder. What can I add... (14 Replies)
Discussion started by: damang111
14 Replies

8. Red Hat

Unable to remove shared memory in Redhat Linux

unable to remove shared memory using ipcrm -m in linux $ ipcs -m ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x00000000 32768 root 644 80 2 0x00000000 65537 root ... (4 Replies)
Discussion started by: LinuxLearner
4 Replies

9. Linux

Unable to access fedora 10 shared folder from windows

Linux OS : Fedora 10 (No graphical mode) Windows OS : XP and Windows Server NT I am able to access from my windows to linux using following step //fedora10 ip username of admin and password I am able to view the admin and shared printer of fedora 10. When i try to enter in the admin... (0 Replies)
Discussion started by: nightmare49
0 Replies

10. Shell Programming and Scripting

Remove zero bytes files in folder

Hi, Please shed some light on how to quickly remove all the zero bytes in which there are some mixtures of more than zero bytes in it. For eg: > ls -lrt -rw-r--r-- 1 ab noen 0 Jul 27 15:47 supplier_mp.unl -rw-rw-r-- 1 ab noen 507 Aug 5 14:13... (2 Replies)
Discussion started by: cedrichiu
2 Replies
Login or Register to Ask a Question