|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Find files
hi all,
In dir1 and dir2 directories I have same subdirectories DH* like --root + dir1 | | + dir2 How to force find command to remove all "*.jpg" files from root. This does not work find DH* -type f -name "*.jpg" -exec rm {} \; thanks oliver |
|
#2
|
|||
|
|||
|
Try escaping the braces
-exec rm \{\} \; I often have difficulty with executing find commands also. |
|
#3
|
|||
|
|||
|
It depends which shell you use - bash and sh do not have a built-in mechanism for expanding sudirectories. On the other hand zsh does it easily, which is why I use it as my default shell - I have never needed to use 'find' when running zsh. In zsh you can replace your script with this:
rm DH*/**/*.jpg The ** expands out recursively through all subdirectories. Dave |
|
#4
|
||||
|
||||
|
Code:
find / -type f -print | grep .jpg | xargs -i rm -f {}
__________________
Bugs that go away by themselves come back by themselves Never take life seriously, Nobody gets out alive anyway. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Other Programming Languages > Find files |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|