Count hidden folders


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Count hidden folders
# 1  
Old 12-21-2013
Count hidden folders

I am newbies and struggling with this tasks.

How to calculate only visible or hidden folders and files in a dictionary?
( i did something like this but it show both visible and hidden files at the same time: ls -l | grep ^- | wc -l )

how to use parse the output of an ls in order to find the size of each file in order to calculate the total space usage.?
( for example :
Code:
Files found: 11 (+ 15 hidden)
Folders found: 4 (+ 2 hidden)
Total files and folders: 32
Total size: 40613 bytes )


please do not use :
Code:
find
locate
du
Any recursive commands (such as ls -R)

many thanks

Last edited by vietanhxienbot; 12-21-2013 at 11:05 AM..
# 2  
Old 12-21-2013
Is this not homework?
# 3  
Old 12-21-2013
yes, its homework. Do u know how to solve that task?

Many thanks
# 4  
Old 12-21-2013
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Rsync - how to copy hidden folder or hidden files when using full path

Hello. I use this command : rsync -av --include=".*" --dry-run "$A_FULL_PATH_S" "$A_FULL_PATH_D"The data comes from the output of a find command. And no full source directories are in use, only some files. Source example... (2 Replies)
Discussion started by: jcdole
2 Replies

2. Shell Programming and Scripting

Copy between two different folders containing same sub-folders

I have a folder like this ls input1 dir1 dir2 dir3 file1 file2 file3 dir1, dir2 and dir3 are sub-folders inside the folder input1 ls input2 dir1 dir2 dir3 file1 file2 file3 My dir1 in input1 folder has files f1, f2, f3 and f4. My dir1 in input2 folder has file f4 and f5. ... (3 Replies)
Discussion started by: jacobs.smith
3 Replies

3. UNIX for Dummies Questions & Answers

List all directories hidden or not hidden

I want to list all directories hidden or not hidden. ls -ld */ => shows only not hidden directories so i guess the answer would be to add the a option to show all files ls -lad */ => not working :confused: ls -la | grep "^d" => works But I would like to know why I can't use ls -lad... (4 Replies)
Discussion started by: servus
4 Replies

4. UNIX for Dummies Questions & Answers

Searching for folders/parent folders not files.

Hello again, A little while back I got help with creating a command to search all directories and sub directories for files from daystart of day x. I'm wondering if there is a command that I've overlooked that may be able to search for / write folder names to an output file which ideally... (2 Replies)
Discussion started by: Aussiemick
2 Replies

5. Shell Programming and Scripting

Making 99 folders 99 folders deep

I am trying to make a unix shell script that will make 99 folders 99 deep (counting the first level folders). So far i have made it make the first 99 folders and 99 more in all of the folders. The only problem is the only way i have found is copying and pasting part of the script over and over and... (18 Replies)
Discussion started by: YukonAppleGeek
18 Replies

6. Shell Programming and Scripting

mv hidden folders

Hi guys! I need to know how I can move hidden folders because I have a script that backs up my svn projects everyday and I have 2 backup folders "Today" and "Yesterday". It is like this: Thanks a lot (2 Replies)
Discussion started by: ruben.rodrigues
2 Replies

7. Shell Programming and Scripting

Script to count files and get the disk usgae on individual mail folders

I have several mail accounts using dovecot maildr format for which I'd like to create a script so that when I run it, for each user it prints not only the name of the user but all of the folders contained and outputs each of the names of the folders created by the user (including the default cur,... (1 Reply)
Discussion started by: phpfreak
1 Replies

8. Shell Programming and Scripting

Finding Hidden files and protecting the folder containing hidden files from deletion

Hi. I have a script which is deleting files with a particular extension and older than 45 days.The code is: find <path> -name "<filename_pattern>" -mtime +45 -exec rm {} \; But the problem is that some important files are also getting deleted.To prevent this I have decide to make a dummy... (4 Replies)
Discussion started by: pochaw
4 Replies

9. Shell Programming and Scripting

Backing up Folders without some folders...;)

I am in a fix....... I have to write a backup script to backup say Folder A. Folder A contains n folders 1,2 ,3 .....n. my script should copy A without folder 2 & 3. Is there anyway I can do it without writing individual copy commands???? Please help.... (1 Reply)
Discussion started by: chimpu
1 Replies
Login or Register to Ask a Question