Sponsored Content
Top Forums Shell Programming and Scripting how to create folder and sub-folder in UNIX ? Post 302335522 by suigion on Monday 20th of July 2009 12:03:38 AM
Old 07-20-2009
how to create folder and sub-folder in UNIX ?

Hi all,

I have the following code to check the whether the folder is exist in my system.

Code:
if [ -d /home/batch/testing ]; then echo 'folder exist'; else echo 'folder not exist'; mkdir /home/batch/testing ; fi

When I remove the "testing" folder from "/home/batch" directory, the code is working fine. But when I remove folder "/batch/testing" from "/home" directory, the code is not working. Actually I want to test whether the code is able to create directory "/batch/testing" in "/home" folder.

Anybody know how to do that?
thanks .. Smilie

---------- Post updated at 11:03 PM ---------- Previous update was at 11:01 PM ----------

The error message I get is /home/batch: A file or directory in the path name does not exist.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parse the .txt file for folder name and FTP to the corrsponding folder.

Oracle procedure create files on UNIX folder on a regular basis. I need to FTP files onto windows server and place the files, based on their name, in the corresponding folders. File name is as follows: ccyymmddfoldernamefile.txt; Folder Name length could be of any size; however, the prefix and... (3 Replies)
Discussion started by: MeganP
3 Replies

2. UNIX for Dummies Questions & Answers

create folder in windows from unix while FTP

Hi, I would like to know if it's possible to create a folder in a Windows Server while running a ftp script in Unix. The idea is to create a script that searches for different files in folders, and when the file is found, take the path of that file and create it to Windows and ftp the file to... (0 Replies)
Discussion started by: Metalero de Oz
0 Replies

3. UNIX for Advanced & Expert Users

Auto copy for files from folder to folder upon instant writing

Hello all, I'm trying to accomplish that if a file gets written to folder /path/to/a/ it gets automatically copied into /path/to/b/ the moment its get written. I thought of writing a shell script and cron it that every X amount of minutes it copies these files over but this will not help me... (2 Replies)
Discussion started by: Bashar
2 Replies

4. Windows & DOS: Issues & Discussions

How can I upload a zip folder on a unix path from my windows folder?

Hello, I am an amature at UNIX commands and functionality. Please could you all assist me by replying to my below mentioned querry : How can I upload a zip folder on a unix path from my windows folder? Thanks guys Cheers (2 Replies)
Discussion started by: ajit.yadav83
2 Replies

5. UNIX for Dummies Questions & Answers

Jar/Tar to a diffent folder/same folder w/ filename

Hi, I want to extract myfile.war to a folder which is in the same folder with war file.I did this as normal: jar -xvf myfile.war But it exploded all the content of file to the same level folder instead of that I was expecting to create a folder called myfile. This works with tar: ... (0 Replies)
Discussion started by: reis3k
0 Replies

6. Shell Programming and Scripting

File Management: How do I move all JPGS in a folder structure to a single folder?

This is the file structure: DESKTOP/Root of Photo Folders/Folder1qweqwasdfsd/*jpg DESKTOP/Root of Photo Folders/Folder2asdasdasd/*jpg DESKTOP/Root of Photo Folders/Folder3asdadfhgasdf/*jpg DESKTOP/Root of Photo Folders/Folder4qwetwdfsdfg/*jpg DESKTOP/Root of Photo... (4 Replies)
Discussion started by: guptaxpn
4 Replies

7. Shell Programming and Scripting

Find all text files in folder and then copy to a new folder

Hi all, *I use Uwin and Cygwin emulator. I´m trying to search for all text files in the current folder (C/Files) and its sub folders using find -depth -name "*.txt" The above command worked for me, but now I would like to copy all found text files to a new folder (C/Files/Text) with ... (4 Replies)
Discussion started by: cgkmal
4 Replies

8. Shell Programming and Scripting

Shell scripting for moving folder specific files into target directory of that country folder.

I need help to write shell script to copy files from one server to another server. Source Directory UAE(inside i have another folder Misc with files inside UAE folder).I have to copy this to another server UAE folder( Files should be copied to UAE folder and Misc files should be copied in target... (3 Replies)
Discussion started by: naresh2389
3 Replies

9. Shell Programming and Scripting

Request for Shell script to move files from Subfolder to Parent folder and delete sub folder

Hi Team, I am new to shell script and there is a requirement where files should be moved from Subfolder to parent folder. Eg: parent folder --> /Interface/data/test/IN Sub folder -->/Interface/data/test/IN/Invoice20180607233338 Subfolder will be always with timestamp... (6 Replies)
Discussion started by: srivarun15
6 Replies

10. Shell Programming and Scripting

Delete oldest folder based on folder named as date

Hi, I have a script doing backup to synology server, the script create new folder each day with the date as being folder name i.e. 2018-07-30. Just before creating the new folder I want the script to find the oldest folder from the list and delete it including its content. for example... (3 Replies)
Discussion started by: humble_learner
3 Replies
packf(1mh)																packf(1mh)

Name
       packf - compress a folder into a single file

Syntax
       packf [ +folder ] [ msgs ] [ -file name ] [ -help ]

Description
       Each  message in a folder is normally stored as a separate file.  The command takes all messages from the current folder and copies them to
       a single specified file.  Each message in the file is separated by four <CTRL/A>s and a newline.

       You can specify a folder other than the current folder by using the +folder argument.  If you do not want all the messages in a	folder	to
       be packed into one file, you can specify a number of messages or a range of messages with message numbers.

       The first message packed will become the current message.  If you specify a +folder argument, that folder will become the current folder.

       When messages have been packed into a file using you can separate them into individual messages using the command.  See

Options
       -file name
		 Specifies  the  file  in which you want the message(s) to be stored.  If you specify an existing file then the specified messages
		 will be appended to the end of that file.  Otherwise, a new file will be created and the messages placed in it.  If  you  do  not
		 specify  a  filename,	attempts  to  place the messages in a file called in the current working directory.  If this file does not
		 exist, asks whether you want to create it.

       -help	 Prints a list of the valid options to this command.

       The default settings for this command are:

	      +folder defaults to the current folder
	      msgs defaults to all
	      -file ./msgbox

Examples
       The first example shows all the messages in the folder being packed into a file called
       % packf +lrp -file planning

       The next example shows how prompts you if you do not specify a -file option.  A file called is created by in your home directory, and  mes-
       sages 3 to 5 are packed into it:
       % packf +lrp 3-5
       Create file "/machine/disk/username/msgbox"? y

Profile Components
       Path:	      To determine the user's Mail directory
       Msg-Protect:   To set protections when creating a new file

Files
       $HOME/.mh_profile   The user profile.

See Also
       burst(1mh)

																	packf(1mh)
All times are GMT -4. The time now is 06:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy