Sponsored Content
Top Forums Shell Programming and Scripting Deleting empty directories using find Post 302387394 by Scott on Friday 15th of January 2010 03:12:26 PM
Old 01-15-2010
I hope it's OK, but I've changed the subject title to remove the "in Solaris" part, because I think this should work on just about any UNIX.

Thanks for sharing Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

deleting the empty files

as of our requiremnt some x no of files will be created from a third party tool ,out of them one or two files will be empty i.e size is 0. so i want to remove those files which are empty. naming of the files which are created will be like this abc_.txt 0 size abc_1.txt 4000 size abc_2.txt... (1 Reply)
Discussion started by: srivsn
1 Replies

2. Shell Programming and Scripting

Deleting the empty file

Hi, I have a TEST.dat file. As a clean up process, I have to delete the TEST.dat file if it is empty. Basically, I don't want to delete TEST.dat if it contains anything in it but want to delete TEST.dat if it contains any spaces or nothing in it. Is there a command to check if the file... (2 Replies)
Discussion started by: rkumar28
2 Replies

3. Shell Programming and Scripting

deleting empty files in a directory

Hello Gurus, I want to delete only empty files (files with 0 bytes) at once from the local directory. Rightnow I need to go through all the files one by one manually and check the empty files before deleting them. Is there any unix command that finds and deletes empty files in a directory?... (5 Replies)
Discussion started by: berlin_germany
5 Replies

4. Shell Programming and Scripting

Deleting all empty files in sub directories with a command

Hello Friends, Im trying to delete empty files in subdirectories with a command. I can find them checking only one directory in each step and then show them with my command like below moreover i could not add removing part: ls -l */* | awk '{if ($5==0) printf "%3s %2d %s... (5 Replies)
Discussion started by: EAGL€
5 Replies

5. SCO

Deleting a directory that is not empty

I know someone will probably laugh at this question, I probably knew the answer many years ago when I was doing this full time but here goes..... I have a directory that has many files and sub-directories in it, RMDIR will not delete a directory that is not empty so what is the command to... (1 Reply)
Discussion started by: moondogi
1 Replies

6. UNIX for Dummies Questions & Answers

Deleting all rows with empty columns

I have a text file that looks like this: 1 rs523634 8.22486 1 1 rs585160 8.22488 1 rs497228 8.2249 1 1 rs600933 8.225 1 rs480106 8.22531 1 rs600199 8.22533 1 rs529015 8.22534 1 rs598894 8.22534 I want to delete the rows with empty... (2 Replies)
Discussion started by: evelibertine
2 Replies

7. Homework & Coursework Questions

Find and delete empty files and directories

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Need to make a script, to remove all empty files and folders from current category. It also should show the name... (2 Replies)
Discussion started by: Itixop
2 Replies

8. Shell Programming and Scripting

Deleting empty folders

Hey, I need help with writing a shell script that deletes empty folders..anyone? :) Thank you! (5 Replies)
Discussion started by: putukas
5 Replies

9. Shell Programming and Scripting

Find the directories and deleting with wild card

Hi Firends, I have requirement like find the directories in unix after my my deployment is done. generally my requirement as follows. /data/common/scripts is folder and it has multiple scripts in this path. I have taken the back up of scripts folder as below /data/common/0816_scripts... (4 Replies)
Discussion started by: victory
4 Replies

10. UNIX for Beginners Questions & Answers

Empty Directories

Please help me. How i can find empty directories in solaris?? (4 Replies)
Discussion started by: FoDeGe
4 Replies
HW_MODIFYOBJECT(3)							 1							HW_MODIFYOBJECT(3)

hw_Modifyobject - Modifies object record

SYNOPSIS
bool hw_modifyobject (int $connection, int $object_to_change, array $remove, array $add, [int $mode]) DESCRIPTION
This command allows to remove, add, or modify individual attributes of an object record. The object is specified by the Object ID $object_to_change. In order to modify an attribute one will have to remove the old one and add a new one. hw_modifyobject(3) will always remove the attributes before it adds attributes unless the value of the attribute to remove is not a string or array. The keys of both arrays are the attributes name. The value of each array element can either be an array, a string or anything else. If it is an array each attribute value is constructed by the key of each element plus a colon and the value of each element. If it is a string it is taken as the attribute value. An empty string will result in a complete removal of that attribute. If the value is neither a string nor an array but something else, e.g. an integer, no operation at all will be performed on the attribute. This is necessary if you want to add a completely new attribute not just a new value for an existing attribute. If the remove array contained an empty string for that attribute, the attribute would be tried to be removed which would fail since it doesn't exist. The following addition of a new value for that attribute would also fail. Setting the value for that attribute to e.g. 0 would not even try to remove it and the addition will work. If you would like to change the attribute 'Name' with the current value 'books' into 'articles' you will have to create two arrays and call hw_modifyobject(3). Example #1 modifying an attribute <?php // $connect is an existing connection to the Hyperwave server // $objid is the ID of the object to modify $remarr = array("Name" => "books"); $addarr = array("Name" => "articles"); $hw_modifyobject($connect, $objid, $remarr, $addarr); ?> In order to delete/add a name=value pair from/to the object record just pass the remove/add array and set the last/third parameter to an empty array. If the attribute is the first one with that name to add, set attribute value in the remove array to an integer. Example #2 adding a completely new attribute <?php // $connect is an existing connection to the Hyperwave server // $objid is the ID of the object to modify $remarr = array("Name" => 0); $addarr = array("Name" => "articles"); $hw_modifyobject($connect, $objid, $remarr, $addarr); ?> Note Multilingual attributes, e.g. 'Title', can be modified in two ways. Either by providing the attributes value in its native form 'language':'title' or by providing an array with elements for each language as described above. The above example would than be: Example #3 modifying Title attribute <?php $remarr = array("Title" => "en:Books"); $addarr = array("Title" => "en:Articles"); $hw_modifyobject($connect, $objid, $remarr, $addarr); ?> or Example #4 modifying Title attribute <?php $remarr = array("Title" => array("en" => "Books")); $addarr = array("Title" => array("en" => "Articles", "ge"=>"Artikel")); $hw_modifyobject($connect, $objid, $remarr, $addarr); ?> This removes the English title 'Books' and adds the English title 'Articles' and the German title 'Artikel'. Example #5 removing attribute <?php $remarr = array("Title" => ""); $addarr = array("Title" => "en:Articles"); $hw_modifyobject($connect, $objid, $remarr, $addarr); ?> Note This will remove all attributes with the name 'Title' and adds a new 'Title' attribute. This comes in handy if you want to remove attributes recursively. Note If you need to delete all attributes with a certain name you will have to pass an empty string as the attribute value. Note Only the attributes 'Title', 'Description' and 'Keyword' will properly handle the language prefix. If those attributes don't carry a language prefix, the prefix 'xx' will be assigned. Note The 'Name' attribute is somewhat special. In some cases it cannot be complete removed. You will get an error message 'Change of base attribute' (not clear when this happens). Therefore you will always have to add a new Name first and than remove the old one. Note You may not surround this function by calls to hw_getandlock(3) and hw_unlock(3). hw_modifyobject(3) does this internally. PARAMETERS
o $connection - The connection identifier. o $object_to_change - The object to be changed. o $remove - An array of attributes to remove. o $add - An array of attributes to add. o $mode - The last parameter determines if the modification is performed recursively. 1 means recursive modification. If some of the objects cannot be modified they will be skipped without notice. hw_error(3) may not indicate an error though some of the objects could not be modified. RETURN VALUES
Returns TRUE on success or FALSE on failure. PHP Documentation Group HW_MODIFYOBJECT(3)
All times are GMT -4. The time now is 01:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy