[SOLVED] Delete files and folders under given directory
I have a requirement to delete the files and folders under a given directory.
my directory structure is like this..
HTML Code:
Data
|
A(Directory)
|_PDF(Directory)----pdf files
|_XML()Directory --xml files
|--files
|
B(Directory)
|_PDF(Directory)----pdf files
|_XML()Directory --xml files
|--files
|
C(Directory)
|_PDF(Directory)----pdf files
|_XML()Directory --xml files
|--files
|
n directories and sub directories
I need to delete the files and folders underneath A(Directory),B(Directory),C(Directory) ... N(Directory) and not the directories it self.
Directory should be there.Basically Data and underneath directories should remain. But all sub-directories should be empty.
i tried like this but it deletes all the directories and folders under given
directory
HTML Code:
find $folderPathTodelete -mindepth 1 -delete
Appreciate if anybody can help me with this.
Thanks
-Ramse
---------- Post updated at 04:50 PM ---------- Previous update was at 04:29 PM ----------
It's working when i changed mindepth to 2. :-)
Last edited by radoulov; 09-04-2011 at 11:03 AM..
Reason: Marked as solved.
Hi,
I want to write a script that deletes all folders and keep the last 10 recent folders.
I know the following:
ls -ltr will sort the folders from old to recent.
ls -ltr | awk '{print $9}' will list the folder names (with a blank line at the beginning)
I want to get the 10th folder from... (3 Replies)
I do not know much about shell scripting so I am at a loss here. If someone can help me, that would be great!
I have two directories
/dir1
/dir2
I need to delete all files from /dir1 and that does not have a correspondent file in /dir2. It should NOT check file suffixes in /dir2 . Why?... (20 Replies)
I need to delete a folder and files in it of yesterdays and simply put this in cron.
Folder name - "2010-03-2010"
File name - "eprod_06_23.dmp" and "eprod_06_23.exp"
Actually this folder and file is been created by a script which takes a backup of DB everyday.Thats why it creates folder and file... (3 Replies)
I need some help writing a simple script that will delete all subfolders that contain no mpg or nuv files, if they have anything else or are empty the folder should be deleted
I got this far but I'm pretty hopeless
foo=0
if
then
foo=1
fi
if
then
foo=1
fi
if
then
echo found... (9 Replies)
Folks,
I am hopeful that you may be able to help me out with writing a script that can be run nightly (as cron?) to loop through all subfolders within the "/media" directory, delete all of the files in each of them, and then copy in all of the files from the "/home//sansa" directory to each of... (6 Replies)
I need help.
I have to delete multiple directories inside a directory that are two weeks old.
Example: Today is July 09, 2012
Folder1 > folder1 (created June 4, 2012) -- should be deleted
> folder2 (created June 2, 2012) -- should be deleted
> folder3 (created... (4 Replies)
How to copy files from one directory to another directory with the subfolders copied.
If i have folder1/sub1/sub2/* it needs to copy files to folder2/sub1/sub2/*.
I do not want to create sub folders in folder2.
Can copy command create them automatically?
I tried cp -a and cp -R but did... (4 Replies)
Hi Everyone,
I work for GE Money IVR as a DB analyst and the environment on which I work is Solaris 5.0 server and Oracle 11g.
I got a project in which I have to clean up the folders and files which are not used in DB.
I copied an existing script and edited it, dont know this is the... (5 Replies)
hi,
i have a requirement to delete all the files from all the directories except some specific directories like archive and log.
for example:
there are following directories such as
A B C D Archive E Log F
which contains some sub directories and files. The requirement is to delete all the... (7 Replies)
Discussion started by: Little
7 Replies
LEARN ABOUT OPENSOLARIS
libgconf-2
libgconf-2(3) C Library Functions libgconf-2(3)NAME
libgconf-2 - GNOME Configuration API
DESCRIPTION
The libgconf-2 library is used by applications to store or retrieve configuration data.
To access the API documentation, you must install the developer version of the package.
FILES
The following files are used by this application:
/usr/lib/libgconf-2.so GNOME Configuration API shared library
/etc/gconf/version_number/path File containing the locations of the various GConf configuration files
$HOME/.gconf Directory containing configuration database for GCconf
/etc/gconf/gconf.xml.defaults Directory containing the default system configuration settings
/etc/gconf/gconf.xml.mandatory Directory containing the mandatory system configuration settings
/etc/gconf/schemas Directory containing the system GConf schema files
/usr/share/gtk-doc/html/gconf Location of developer documentation
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWgnome-config |
+-----------------------------+-----------------------------+
|Interface stability |Volatile |
+-----------------------------+-----------------------------+
SEE ALSO gconf-editor(1), gconftool-2(1), attributes(5), gnome-interfaces(5)NOTES
Written by Ghee Teo and Brian Cameron, Sun Microsystems Inc., 2003, 2004, 2006.
SunOS 5.11 31 Aug 2004 libgconf-2(3)