Forceful deletion of folder not working


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Forceful deletion of folder not working
# 1  
Old 01-17-2012
Forceful deletion of folder not working

Hello,
I am trying to delete a folder forcefully using the command:
Code:
rm -rf <dir name>

but its still asking for confirmation.
Please help me out with a solution.

scenario:
Code:
bash-3.00$ chmod 777 gcc-3.4.2
bash-3.00$
bash-3.00$
bash-3.00$
bash-3.00$ rm -rf gcc-3.4.2/
rm: examine files in directory gcc-3.4.2/ (yes/no)? yes
rm: examine files in directory gcc-3.4.2//gcc (yes/no)? yes
rm: examine files in directory gcc-3.4.2//gcc/cp (yes/no)?

Regards,
Harish

Last edited by Franklin52; 01-17-2012 at 03:15 AM.. Reason: Please use code tags for code and data samples, thank you
# 2  
Old 01-17-2012
Code:
chmod -R 777 gcc-3.4.2

Then try to delete it forcefully. Or check whethere you have any alias for rm command
# 3  
Old 01-17-2012
Hi,
you can use this way also
Code:
yes|rm -rf gcc-3.4.2/

thanks,
venkat

Last edited by Franklin52; 01-17-2012 at 03:15 AM.. Reason: Please use code tags for code and data samples, thank you
# 4  
Old 01-17-2012
@venkat: It works that way.. Thanks a lot for your response..!!

Regards,
Harish

---------- Post updated at 12:15 PM ---------- Previous update was at 12:03 PM ----------

@itkamaraj: even if i give
chmod -R 777 gcc-3.4.2, it still asks for permission..:-(

---------- Post updated at 12:17 PM ---------- Previous update was at 12:15 PM ----------

@itkamaraj:i am extremely sorry.. its because.. it has an alias.

Regards,
Harish
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using sed command to replace "|" with ^ for all *.dat files in a folder not working

I am trying to use the below sed command to replace all "|" to ^, in a folder had 50 dat files. when i tried with 1 file it worked but when i tried with wild card, is not working. sed -i 's/"|"/\^/g' *.dat Is this the proper way to use sed command thank you very much for help. (3 Replies)
Discussion started by: cplusplus1
3 Replies

2. Shell Programming and Scripting

Request for Shell script to move files from Subfolder to Parent folder and delete sub folder

Hi Team, I am new to shell script and there is a requirement where files should be moved from Subfolder to parent folder. Eg: parent folder --> /Interface/data/test/IN Sub folder -->/Interface/data/test/IN/Invoice20180607233338 Subfolder will be always with timestamp... (6 Replies)
Discussion started by: srivarun15
6 Replies

3. Red Hat

Sorting folder size not working

I am using du -h --max-depth=2 to get list of folders by size upto 2 levels down. Problem is I am not able to sort them in max folder size. Normally this can be achieved by using du -k | sort -nr * but I can't use it here since it conflicts (the -s argument) with the --max-depth=2 argument. ... (1 Reply)
Discussion started by: rockf1bull
1 Replies

4. Shell Programming and Scripting

The checking of folder existance is not working...

Hi all, I have the following code: if ; then echo 'folder not exist'; else echo 'folder exist'; fi The "testing" folder is not exist in /home/batch , but thhe result is 'folder exist'. It seems that the code cannot detect that the folder "testing" not exist. ANybody know the... (1 Reply)
Discussion started by: suigion
1 Replies

5. Shell Programming and Scripting

Unique Directory and Folder Deletion Script

Ok, so I just got charged with the task of deleting some 300 user folders in a FTP server to free up some space. I managed to grep and cut the list of user folders to delete into a list of one user folder per line. Example: bob00 jane01 sue03 In the home folder, there are folders a-z, and... (5 Replies)
Discussion started by: b4sher
5 Replies

6. Shell Programming and Scripting

File Management: How do I move all JPGS in a folder structure to a single folder?

This is the file structure: DESKTOP/Root of Photo Folders/Folder1qweqwasdfsd/*jpg DESKTOP/Root of Photo Folders/Folder2asdasdasd/*jpg DESKTOP/Root of Photo Folders/Folder3asdadfhgasdf/*jpg DESKTOP/Root of Photo Folders/Folder4qwetwdfsdfg/*jpg DESKTOP/Root of Photo... (4 Replies)
Discussion started by: guptaxpn
4 Replies

7. UNIX for Dummies Questions & Answers

Working with folder names

I have the following directory structure: /maindir /maindir/product1/ /maindir/product1/type1 /maindir/product1/type2 /maindir/product1/type3 /maindir/product2/ /maindir/product2/type1 /maindir/product2/type2 /maindir/product2/type3 /maindir/product2/type4 ... I'm able to traverse... (6 Replies)
Discussion started by: ricksj
6 Replies

8. Solaris

Script for automatic deletion of old folder

Hi, I have a folder with limited space. So i have to delete folder which are more than 5 days old automatically. So my script should be like delete the folder more than 5 days old. Can someone help me to generate a script for this. Thank you... Cheer Summer (5 Replies)
Discussion started by: summerpeh
5 Replies

9. Shell Programming and Scripting

Finding Hidden files and protecting the folder containing hidden files from deletion

Hi. I have a script which is deleting files with a particular extension and older than 45 days.The code is: find <path> -name "<filename_pattern>" -mtime +45 -exec rm {} \; But the problem is that some important files are also getting deleted.To prevent this I have decide to make a dummy... (4 Replies)
Discussion started by: pochaw
4 Replies

10. Shell Programming and Scripting

MV not working from other folder

hi , I have wriiten code in shell script to rename files as $MV ${SOURCE}/index.html ${DEST}/index_en.html I have set the variables and the souce & Dest are same folder.But when i run i am getting the following error DESTdest/index_en.html mv: cannot access SOURCE/index.html is there... (1 Reply)
Discussion started by: Mar1006
1 Replies
Login or Register to Ask a Question