From: moonhkt on 9 Mar 2010 02:06 Hi All Any suggestion ? Currently, I am using below shell command cd delete_path rm -f * # remove current directory files rm -f */* # remove subdirectory files rm -f */*/* # repeat ... rm -f */*/*/* rm -f */*/*/*/* rm -f */*/*/*/*/* rm -f */*/*/*/*/*/* rm -f */*/*/*/*/*/*/* rm -f */*/*/*/*/*/*/*/* du -k | awk '{print $2}' |sort -r |xargs rmdir -p # remove all subdirectory moonhkt
From: Janis Papanagnou on 9 Mar 2010 02:30 moonhkt wrote: > Hi All > > Any suggestion ? Currently, I am using below shell command rm(1) has options -r/-R to remove all subdiretories/files. See man rm for details. Other solutions to delete specific files are find(1) with option -exec and a remove command or find(2) with -print0 and xargs -O. See man find for details, or browse this group's archives since this is a frequent question. Janis > > cd delete_path > rm -f * # remove current directory files > rm -f */* # remove subdirectory files > rm -f */*/* # repeat ... > rm -f */*/*/* > rm -f */*/*/*/* > rm -f */*/*/*/*/* > rm -f */*/*/*/*/*/* > rm -f */*/*/*/*/*/*/* > rm -f */*/*/*/*/*/*/*/* > du -k | awk '{print $2}' |sort -r |xargs rmdir -p # remove all > subdirectory > > moonhkt
From: Dominic Fandrey on 9 Mar 2010 02:36 On 09/03/2010 08:06, moonhkt wrote: > Hi All > > Any suggestion ? Currently, I am using below shell command > > cd delete_path > rm -f * # remove current directory files > rm -f */* # remove subdirectory files > rm -f */*/* # repeat ... What you are looking for is the both dangerous and popular drug rm -rf * -- A: Because it fouls the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail?
From: jellybean stonerfish on 9 Mar 2010 04:10 On Mon, 08 Mar 2010 23:06:54 -0800, moonhkt wrote: > Hi All > > Any suggestion ? Currently, I am using below shell command > > cd delete_path > rm -f * # remove current directory files rm -f */* # remove > subdirectory files rm -f */*/* # repeat ... rm -f */*/*/* > rm -f */*/*/*/* > rm -f */*/*/*/*/* > rm -f */*/*/*/*/*/* > rm -f */*/*/*/*/*/*/* > rm -f */*/*/*/*/*/*/*/* > du -k | awk '{print $2}' |sort -r |xargs rmdir -p # remove all > subdirectory > > moonhkt Wow, that was a lot of work to replace 'rm -rf'
From: Ed Morton on 9 Mar 2010 07:35 On 3/9/2010 1:06 AM, moonhkt wrote: > Hi All > > Any suggestion ? Currently, I am using below shell command > > cd delete_path > rm -f * # remove current directory files > rm -f */* # remove subdirectory files > rm -f */*/* # repeat ... > rm -f */*/*/* > rm -f */*/*/*/* > rm -f */*/*/*/*/* > rm -f */*/*/*/*/*/* > rm -f */*/*/*/*/*/*/* > rm -f */*/*/*/*/*/*/*/* > du -k | awk '{print $2}' |sort -r |xargs rmdir -p # remove all > subdirectory > > moonhkt Genuinely curious - "rm" only has about 5 or 6 options so when you looked up the man page did you not understand what "recursively" meant or not notice it or was it something else? Ed.
|
Next
|
Last
Pages: 1 2 3 4 5 6 Prev: differecnce between ${IFS} and "${IFS}" Next: Mapping home and end keys - ksh and Putty |