Sponsored Content
Top Forums UNIX for Dummies Questions & Answers how to find empty folders without using -empty Post 302159012 by ghostdog74 on Wednesday 16th of January 2008 10:19:55 PM
Old 01-16-2008
Code:
# ls -l * | awk '/total 0/{print last}{last=$0}'

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to find files not empty?

Is there any way, we can find files not empty? I know one can find empty files by using find with -size is equalled to 0. Please let me know, how I can find files greater than 0 or any other size in number? (2 Replies)
Discussion started by: videsh77
2 Replies

2. UNIX for Dummies Questions & Answers

zip nesting empty folders

I'm using the following command to zip a project file, but when it finishes, the resulting zip file contains all the directories above the file I wanted zipped, myapp.app, each one empty until you get to the actual app. zip -r myapp.app.zip ... (0 Replies)
Discussion started by: groundlevel
0 Replies

3. UNIX for Dummies Questions & Answers

Removing empty folders using the "find" command

Hi I'm trying to remove empty sub-folders from 1 main folder using the find method, but the "- empty" parameter isn't recognized by my Unix version. Any idea how to implement such thing? Thanks. (3 Replies)
Discussion started by: biot
3 Replies

4. UNIX for Dummies Questions & Answers

Removing empty folders using 'find'

Hey there! I try to use 'find' to remove empty directories like this: find . -depth -type d -empty -exec rm -rf {} ';' It works just fine, but there are some directories i want to exclude. So i tried to do sth like this: find . -depth -type d -empty -exec grep -v "not this one please" -exec... (5 Replies)
Discussion started by: deTTo
5 Replies

5. UNIX for Dummies Questions & Answers

Getting same exit status for empty and non empty file

Hi All, I am checking for a empty input file to do some further action , but I am getting exit status 0 in both the cases , for empty and non empty file both. The value of $? is coming 0 in if part also and else part too. #!/bin/ksh if ]; then echo "data" # exit 0 echo "$?" else... (4 Replies)
Discussion started by: mavesum
4 Replies

6. Shell Programming and Scripting

Find empty folders

In current folder, there are many subfolders, subfolder's subfolders... under it. How can I find out the empty folders with no files in it. I only need the top folder list. For example, I have folders like below: a/b/c a/b/x/x.txt a/s a/s/y I need get the folder a/s, but not... (6 Replies)
Discussion started by: rdcwayx
6 Replies

7. UNIX for Dummies Questions & Answers

Removing empty folders

Hello, I have a folder that contains all my music. Recently, I started using a different media player, and I let it manage my music folder. It has sorted all my music neatly in folders by artist and album. However, all the old folders that the songs used to be in are still there, yet they are... (2 Replies)
Discussion started by: emveedee
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. Windows & DOS: Issues & Discussions

Empty folders with SFU

Hi all, i am currently setting my windows XP environment to use with Services for Unix (NFS Client) to mount my unix file system as a network drive. However, though i could mount the unix file directory successful, but the folder is empty (which is not). Why is this so? i have imported my unix... (6 Replies)
Discussion started by: lchunleo
6 Replies

10. UNIX for Dummies Questions & Answers

How to delete some empty folders?

I have an amount of folders and I want to delete only the empty ones. But I have more than 200 empty folders, so I would preffer do not delete one by one... I know it is possible, but I don't know how. I've tried with the size, using 'du' command, and saving the result in a file. After that, I made... (3 Replies)
Discussion started by: saitsug
3 Replies
Data::Page(3)						User Contributed Perl Documentation					     Data::Page(3)

NAME
Data::Page - help when paging through sets of results SYNOPSIS
use Data::Page; my $page = Data::Page->new(); $page->total_entries($total_entries); $page->entries_per_page($entries_per_page); $page->current_page($current_page); print " First page: ", $page->first_page, " "; print " Last page: ", $page->last_page, " "; print "First entry on page: ", $page->first, " "; print " Last entry on page: ", $page->last, " "; DESCRIPTION
When searching through large amounts of data, it is often the case that a result set is returned that is larger than we want to display on one page. This results in wanting to page through various pages of data. The maths behind this is unfortunately fiddly, hence this module. The main concept is that you pass in the number of total entries, the number of entries per page, and the current page number. You can then call methods to find out how many pages of information there are, and what number the first and last entries on the current page really are. For example, say we wished to page through the integers from 1 to 100 with 20 entries per page. The first page would consist of 1-20, the second page from 21-40, the third page from 41-60, the fourth page from 61-80 and the fifth page from 81-100. This module would help you work this out. METHODS
new This is the constructor, which takes no arguments. my $page = Data::Page->new(); There is also an old, deprecated constructor, which currently takes two mandatory arguments, the total number of entries and the number of entries per page. It also optionally takes the current page number: my $page = Data::Page->new($total_entries, $entries_per_page, $current_page); total_entries This method get or sets the total number of entries: print "Entries:", $page->total_entries, " "; entries_per_page This method gets or sets the total number of entries per page (which defaults to 10): print "Per page:", $page->entries_per_page, " "; current_page This method gets or sets the current page number (which defaults to 1): print "Page: ", $page->current_page, " "; entries_on_this_page This methods returns the number of entries on the current page: print "There are ", $page->entries_on_this_page, " entries displayed "; first_page This method returns the first page. This is put in for reasons of symmetry with last_page, as it always returns 1: print "Pages range from: ", $page->first_page, " "; last_page This method returns the total number of pages of information: print "Pages range to: ", $page->last_page, " "; first This method returns the number of the first entry on the current page: print "Showing entries from: ", $page->first, " "; last This method returns the number of the last entry on the current page: print "Showing entries to: ", $page->last, " "; previous_page This method returns the previous page number, if one exists. Otherwise it returns undefined: if ($page->previous_page) { print "Previous page number: ", $page->previous_page, " "; } next_page This method returns the next page number, if one exists. Otherwise it returns undefined: if ($page->next_page) { print "Next page number: ", $page->next_page, " "; } splice This method takes in a listref, and returns only the values which are on the current page: @visible_holidays = $page->splice(@holidays); skipped This method is useful paging through data in a database using SQL LIMIT clauses. It is simply $page->first - 1: $sth = $dbh->prepare( q{SELECT * FROM table ORDER BY rec_date LIMIT ?, ?} ); $sth->execute($page->skipped, $page->entries_per_page); change_entries_per_page This method changes the number of entries per page and the current page number such that the first item on the current page will be present on the new page. $page->total_entries(50); $page->entries_per_page(20); $page->current_page(3); print $page->first; # 41 $page->change_entries_per_page(30); print $page->current_page; # 2 - the page that item 41 will show in NOTES
It has been said before that this code is "too simple" for CPAN, but I must disagree. I have seen people write this kind of code over and over again and they always get it wrong. Perhaps now they will spend more time getting the rest of their code right... SEE ALSO
Related modules which may be of interest: Data::Pageset, Data::Page::Tied, Data::SpreadPagination. AUTHOR
Based on code originally by Leo Lapworth, with many changes added by by Leon Brocard <acme@astray.com>. CONTRIBUTORS
James Laver (ELPENGUIN) COPYRIGHT
Copyright (C) 2000-9, Leon Brocard LICENSE
This module is free software; you can redistribute it or modify it under the same terms as Perl itself. perl v5.18.2 2017-10-06 Data::Page(3)
All times are GMT -4. The time now is 02:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy