It appears that, after doing more research, the keep_root variable does not 
keep the \data folder intact but removes it.  Unless I am mistaken, is there 
another method to cleaning a directory of files and subdirectories without 
removing the directory itself?
(I know I can do it programmatically but I was wondering if there was a 
'1-liner' like the one previously listed).


----- Forwarded Message ----
From: Tony Esposito <tony1234567...@yahoo.co.uk>
To: Beginners Perl <beginners@perl.org>
Sent: Wednesday, 13 May, 2009 12:56:45
Subject: deleting subdirectories only in Win32

Hello,
  When trying to delete subdirectories and their files on WinXP SP3, the 
following code also removes the root directory of the subdirectories.  Can I 
get some assistance?  I want to keep C:\my\data intact but I am losing the 
\data folder

#
# Code to remove all files and subdirectories under C:\my\data
#
perl -e "use File::Path; rmtree('C:/my/data',{keep_root => 1, safe => 1});"


      

Reply via email to