Re: removing directories

看板FB_questions作者時間14年前 (2011/11/05 02:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串5/6 (看更多)
On Fri, 4 Nov 2011, Graeme Dargie wrote: > Ok this might be a bit of a newbie question but here goes. > > I have a large number of directories around 300 which all have sub dirs, > some of those have sub dirs in each of these there are two further sub > dirs called pages and thumbnails, is there an easy way to remove all the > pages and thumbnail dirs from the tree? the easiest way to remove one directory and all of its contents including subdirectories and their contents is rm -r dirname if you put the trailing slash in rm -r dirname/ you will remove the contents but not the directory itself. To remove 300 will still be a considerable task if you cannot find a way to get at the only ones you want to remove. See man [ for ideas on how to test for the existence of pages/ and thumbnail/ subdirectories. This could be the basis of a shell script for identifying and removing the directories you want to target. If there is relatively litte stuff in the parent directory that you want to save, it may be easier to remove the stuff you want to save to a safe place, remove the contents of the parent directory, and move the saved stuff back. Backing up everything before you start is a really good idea even if you are a shell script wizard. > > Regards > > G > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" > > > -- Lars Eighner http://www.larseighner.com/index.html 8800 N IH35 APT 1191 AUSTIN TX 78753-5266 _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
文章代碼(AID): #1Ej2-ZTP (FB_questions)
文章代碼(AID): #1Ej2-ZTP (FB_questions)