how to delete all the files with extension .dat rom a
directory tree from root to third level in a single unix
command?

Answers were Sorted based on User's Feedback



how to delete all the files with extension .dat rom a directory tree from root to third level in a..

Answer / vipul dalwala

find . -name *.dat -maxdepth 3 -exec rm -f {} \;

Is This Answer Correct ?    10 Yes 0 No

how to delete all the files with extension .dat rom a directory tree from root to third level in a..

Answer / sreekanth turuka

grep -l "*.dat" /dir1/dir2/dir3 | rm

Is This Answer Correct ?    0 Yes 0 No

how to delete all the files with extension .dat rom a directory tree from root to third level in a..

Answer / saravanan

rm `find -maxdepth 2 -name *.dat`

Is This Answer Correct ?    0 Yes 0 No

how to delete all the files with extension .dat rom a directory tree from root to third level in a..

Answer / lakshman

1st find the .dat file and place in file
example :
find . -name *.date > temp

then add rm infrent of paths in that file adn run the script.
example :
:%s/\.\//rm \.\//

open temp file run above vi command and rm the script

example :
sh temp

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More Shell Script Interview Questions

Hi All, Is it possible to create one file name only space or space in file name in UNIX and we can able to run that on Unix?

2 Answers   Cap Gemini,


Explain about sourcing commands?

0 Answers  


What are the zombie processes?

0 Answers  


What are the three main forms of enabling debugging in a shell script?

6 Answers   ADC, Wipro,


Is powershell a bash?

0 Answers  






How to get the first line from a file using just the terminal?

0 Answers  


write a shell script to check whether all the directories in the path exist has read and write permission

1 Answers  


Write down the syntax for all the loops in shell scripting.

0 Answers  


How to write an Auto scripting for deleting old files using shell script and made a cron job to run on daily basis

1 Answers  


How to handle the delimiter unit seperator in Unix

2 Answers  


How do I run a script from command prompt?

0 Answers  


Create a bash shell script that reads a line from the user consisting of 5 words and then prints them out in reverse order. Name this script "reverse.sh"

1 Answers  


Categories