Sponsored Content
Top Forums Shell Programming and Scripting Making 99 folders 99 folders deep Post 302517066 by alister on Tuesday 26th of April 2011 02:36:26 AM
Old 04-26-2011
Quote:
Originally Posted by YukonAppleGeek
I am trying to make 5 sub folders with out having to copy/paste/reformat the code. I know it is posable but i am wondering if there is a easer way of do that, i am also some what new to unix shell scripting. (I also will probably not do 99 folders more like 20-50)
If your intention is to implement the algorithm in your original post, you really need to come to terms with the numbers you'd be dealing with. Based on how far you got in 23 minutes, and generously slashing the time per directory from 1.5 milliseconds to 1 millisecond flat, the following is approximately how long it would take to create n levels of n directories in each directory:

Code:
20:  3 trillion millenia
15:  14,000 millenia
10:  4 months
 9:  4.5 days
 8:  4.5 hours
 7:  14 minutes
 6:  47 seconds
 5:  3 seconds

It blows up quickly, so you'll probably want to keep it small. If you don't mind saying, why are you doing this? I'm curious.

Regards,
Alister

The arithmetic:
((((((20^20) * .001) / 60) / 60) / 24) / 365) / 1 000 = 3.32501268 × 10^12
((((((15^15) * .001) / 60) / 60) / 24) / 365) / 1 000 = 13,885.5242
(((((10^10) * .001) / 60) / 60) / 24) / 30 = 3.85802469
((((9^9) * .001) / 60) / 60) / 24 = 4.48403344
(((8^8) * .001) / 60) / 60 = 4.66033778
((7^7) * .001) / 60 = 13.7257167
(6^6) * .001 = 46.65600
(5^5) * .001 = 3.12500
 

10 More Discussions You Might Find Interesting

1. 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

2. UNIX for Dummies Questions & Answers

Copying 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.... (5 Replies)
Discussion started by: chimpu
5 Replies

3. Shell Programming and Scripting

Renaming folders

Hello, I'm new to unix and I have to rename all folder fron the current folder from a name like "xx - Name of the Folder" to "Name of the Folder - xx". xx is a number ... Can somebody, please, help? Thank you! (6 Replies)
Discussion started by: mirciulicai
6 Replies

4. Shell Programming and Scripting

How to hide folders

hello everybody, i would like to hide visibility of the folders , i.e. not to giving any physically visibility to any users . Is there any way to do it other than changing the permission and adding "." post folder name . by changing the permission , we cann't do any activity , but have... (1 Reply)
Discussion started by: manas_ranjan
1 Replies

5. 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

6. Solaris

Folders with more than one 'owner'

I have a peculiar problem. I have a particular directory with the following characteristics: -bash-3.00# ls -lah total 18 drwxr-x--- 7 gandalf shire 512 jul 3 07:20 . drwxr-x--- 11 gandalf shire 512 mai 10 2010 .. drwxr-xr-x 6 gandalf shire 3,0K jul 24 19:25 brasdeff drwxr-xr-x... (9 Replies)
Discussion started by: poyato
9 Replies

7. 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

8. UNIX for Dummies Questions & Answers

Archive folders and sub folders

Hi Can i archive folder and folders in with the tar command My files are located in subfolders Eg: Folder1/Folder1_1/*.pdf Folder1/Folder1_2/*.pdf Folder1/Folder1_3/*.pdf so i would like to tar all the files in Folder1_1 and Folder1_2 only not Folder1_3 that should be done next... (2 Replies)
Discussion started by: cnrj
2 Replies

9. Shell Programming and Scripting

Exclude certain folders

Hi Experts, Below is my shell script and it will move the files older than 90 days to archive mount. Now my new requirement is , I need to move some of the directory files older than 365 days. How can I achieve this. Simply I have DIR1 DIR2 DIR3 DIR4 I need to exclude DIR 2 and DIR 2... (5 Replies)
Discussion started by: arumugavelvelu
5 Replies

10. Shell Programming and Scripting

How to copy files/folders and show the files/folders?

Hi, So i know we use cp -r as a basic to copy folders/files. I would like this BUT i would like to show the output of the files being copied. With the amazing knowledge i have i have gone as far as this: 1) find source/* -exec cp -r {} target/ \; 2) for ObjectToBeCopied in `find... (6 Replies)
Discussion started by: Imre
6 Replies
sharing(1)						    BSD General Commands Manual 						sharing(1)

NAME
sharing -- create share points for afp, ftp and smb services. SYNOPSIS
sharing [-a <path> [options]] [-e <share point name> [options]] [-r <share point name>] [-l] DESCRIPTION
A list of flags and their descriptions: -a <path> add a new share point for the directory specified by <path>. -e <share point name> edit the share point record specified by <share point name>. -r <share point name> delete the share point record specified by <share point name>. -l list all existing share point records. Description of options The following options modify share point record attributes -A <afp name> use customized name <afp name> when using share point with afp. -F <ftp name> use customized name <ftp name> when using share point with ftp. -S <smb name> use customized name <smb name> when using share points with smb. -s <flags> use this option to modify individually, the sharing attribute for afp, ftp and smb. By default a share point record is enabled for afp, ftp and smb. To modify the indiviual attributes AND the following flags as required: 100 (enable sharing for afp only), 010 (enable sharing for ftp only), 001 (enable sharing for smb only). Specify 000 to turn off sharing of a share point all together. use customized name <smb name> when using share points with smb. -g <guest flag> use this option to modify individually, the "guest" attribute for afp, ftp and smb. The "guest" attribute specifies whether a ser- vice will allow guest access to this share point record. By default a "guest" is enabled for afp, ftp and smb. To modify the attribute, AND the following <guest flags> as required: 100 (enable guest access for afp only), 010 (enable guest access for ftp only), 001 (enable guest access for smb only). Specify 000 to turn off guest access for the share point all together. -i <inherit privileges flag> use this option to modify the "inherit privileges" attribute for afp. The "inherit privileges" attribute specifies whether afp will apply the classic privilege model to operations within this share point. By default "inherit privileges" is disabled for afp. To modify the "inherit privileges", AND the following <guest flags> as required: 10 (enable "inherit privileges" for afp only). Spec- ify 00 to turn off "inherit privileges" for the share point all together. -n <customized record name> Specify a <customized record name> to be used as the share point record name. By default the record name is the name of the direc- tory pointed to by the share point record. This directory is specified bt the <path> when the record is created. EXAMPLES
/usr/sbin/sharing -a /SomePath/ShareThisDirectory This example shows how create a share point record for the directory "/SomePath/ShareThisDirectory". /usr/sbin/sharing -e ShareThisDirectory -A SP1 -g 101 This example shows how to edit the share point record created above, adding a customized name "SP1" for afp servies, and enabling guest access only for afp and smb. FILES
/usr/sbin/sharing location of tool Mac OS X Server June 2, 2019 Mac OS X Server
All times are GMT -4. The time now is 01:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy