Sponsored Content
Full Discussion: Mass directory creation?
Top Forums UNIX for Dummies Questions & Answers Mass directory creation? Post 78555 by becket on Wednesday 20th of July 2005 01:57:00 PM
Old 07-20-2005
with bash :

Code:
for file in `ls`
do 
mkdir -p $file 
mv $file $file/
done

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Remote directory creation

Is there a way to create a directory in some remote location from a local location? I understand that we can use 'rcp' to copy a local file to a remote location. I am looking for a command in similar lines which lets us create directories in remote locations. Could someone help? (5 Replies)
Discussion started by: srinivay
5 Replies

2. UNIX for Advanced & Expert Users

directory creation

Hi Friends, I am trying to move some files from one directory to another. but if the destination directory doesnt exist then i have to create one and then move files to that. For this i have to write a script. please help. thanks in advance Veera (4 Replies)
Discussion started by: sveera
4 Replies

3. Programming

creation of unwanted directory

hi all i have a file with server id's and I need to create a directory corresponding to each server id listed in the text file. eg: id directory name 1 node_1 2 ... (6 Replies)
Discussion started by: mridula
6 Replies

4. AIX

Filesystem creation over existing Directory

Is it possible to create a Filesystem with the mount point over an existing Directory, without loosing the data in the Directory? eg:- /u01 -> /pmmpd/u01 (Directory with soft link) /pmmpd/u01 (Need to create this filesystem, without loosing data) Thanks TheDoc (0 Replies)
Discussion started by: TheDoc
0 Replies

5. AIX

VI questions : mass changes, mass delete and external insert

Is it possible in VI to do a global change but take the search patterns and the replacement patterns from an external file ? I have cases where I can have 100,200 or 300+ global changes to do. All the new records are inside a file and I must VI a work file to change all of them. Also, can... (1 Reply)
Discussion started by: Browser_ice
1 Replies

6. Shell Programming and Scripting

Directory Creation problem

Hiiii, here is my script-- BackupLocation="$OPTARG" if ]; then echo "Either option l or L should be given to $Programname" echo "$Usage" echo "$Programname is terminated" ... (1 Reply)
Discussion started by: namishtiwari
1 Replies

7. Shell Programming and Scripting

Creation date of a directory

what's the command to find the creation date of a certain dirctory? (1 Reply)
Discussion started by: miss_dodi
1 Replies

8. Cybersecurity

Mass account creation

By the company winning business from another outsource provider, I've suddenly inherited towards 300 servers and all accounts are local. One of the immediate tasks is to set up all the OS, DB, and app support staff on all of the servers operating systems. I've slapped together a crude script... (10 Replies)
Discussion started by: rbatte1
10 Replies

9. UNIX for Beginners Questions & Answers

UNIX directory creation issues

Hi All, I am facing a strange scenario. I upgraded my server version to new version of linux. After the when I create a directory it is created with . in the the permission . What is the reason and how to fix . $ mkdir test $ ls -l total 0 drwxr-xr-x. 2 uk01 users 6 Dec 7 03:49 test ... (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

10. Shell Programming and Scripting

Reason for no directory creation date

i read here that linux provides no way to determine when a directory was created. https://www.unix.com/shell-programming-and-scripting/157874-creation-date-directory.htmlI have a directory /home/andy/scripts that had a README file in it. That file says I put the script in that directory and... (3 Replies)
Discussion started by: drew77
3 Replies
mkpath_np(3)						   BSD Library Functions Manual 					      mkpath_np(3)

NAME
mkpath_np -- Auxiliary routine for efficiently creating paths SYNOPSIS
#include <unistd.h> int mkpath_np(const char * path, mode_t omode); DESCRIPTION
This routine allows the caller to create a path, including intermediate directories. It is equivalent to calling mkdir(1) with the -p com- mand line argument. Intermediate directories are created with permission bits of rwxrwxrwx (0777) as modified by the current umask, plus write and search permis- sion for the owner. The leaf directory is created with permission bits of omode as modified by the current umask. RETURN VALUES
A 0 return value indicates success. If an error occurs, the return value is a non-zero error code. Note that EEXIST is returned iff the leaf directory already exists and is a directory, so under certain circumstances, this error value may not indicate a failure state. This routine does NOT modify errno. ERRORS
Any error code that can be returned by mkdir(2) can be returned by mkpath_np(), but mkpath_np() will return the error code rather than set- ting errno. [ENOTDIR] A component of the path is not a directory (in contrast to mkdir(2) which returns this based on the path prefix rather than the path). [EEXIST] The path already exists and is a directory. HISTORY
This function first appeared in iOS 5.0. SEE ALSO
mkdir(1), chmod(2), mkdir(2) Mac OS X July 13, 2011 Mac OS X
All times are GMT -4. The time now is 03:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy