Sponsored Content
Top Forums Shell Programming and Scripting Script that creates directory structure Post 302596424 by colinwilson1303 on Tuesday 7th of February 2012 10:33:09 AM
Old 02-07-2012
Script that creates directory structure

Hi All,

I have a script that does daily checks on my storage environment and is run from an AIX host.

The script currently works great but I have been changing and updating bits of it to make it easier for my lesser colleagues to understand Smilie

However now with the updates I have made I have a problem. The thing is where the problem is was created by a UNIX scriptor who has now left and there is no one to help troubleshoot the command:

Problem is with creating a directory structure and my variables for creating this directory structure are:

Code:
 
_DATE_DIR="`date +%m"_"%b"_"%Y`"
_DATE_DAILY="`date +%d"."%b"."%Y`"
_DIRECTORY_PATH="/home/xxxxx/CAPACITY/REPORT/DAILY_CHECKS-VMAX/${_DATE_DIR}"
_LOG_FILE="$_DIRECTORY_PATH/${_DATE_DAILY}_Daily_Checks"


The directory structure is created using the following command and is the one command in the whole script I do not fully understand or are able to troubleshoot:

Code:
 
#MAKE DIRECTORY STRUCTURE IF IT DOES NOT EXIST
if [[ ! -d ${_DIRECTORY_PATH} ]]
then
 mkdir -p ${_DIRECTORY_PATH}
fi

when I run the script I get the following output:

Code:
 
+ date +%m_%b_%Y
_DATE_DIR=02_Feb_2012
+ date +%d.%b.%Y
_DATE_DAILY=07.Feb.2012
_DIRECTORY_PATH=/home/isoscwi/CAPACITY/REPORT/DAILY_CHECKS-VMAX/02_Feb_2012
_LOG_FILE=/home/xxxxx/CAPACITY/REPORT/DAILY_CHECKS-VMAX/02_Feb_2012/07.Feb.2012_Daily_Checks
+ [[ ! -d /home/xxxxx/CAPACITY/REPORT/DAILY_CHECKS-VMAX/02_Feb_2012 ]]
./new_daily_script: [[: not found
+ echo
./new_daily_script: /home/xxxxx/CAPACITY/REPORT/DAILY_CHECKS-VMAX/02_Feb_2012/07.Feb.2012_Daily_Checks: cannot create

I am sure this is something simple but I cannot see it myself. The "create the directory stucture" is what the UNIX guy created.

Any ideas on how I can fix this issue?

Cheers
Col

Last edited by colinwilson1303; 02-07-2012 at 11:51 AM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Copying a Directory Structure to a new structure

Hi all Is it possible to copy a structure of a directory only. e.g. I have a file with the following entries that is a result of a find :- /dir1/dir2/file.dbf /dir1/dir2/dir3/file1.dbf /dir1/file.dbf I want to copy these to a directory and keep the structure however starting at a new dir... (8 Replies)
Discussion started by: jhansrod
8 Replies

2. Shell Programming and Scripting

Need script to make big directory structure

Hi, I'm a novice and I'd like to make a directory structure with a hundred or so folders. I've tried mkdir /foo/foo1/etc... mkdir /foo/foo2/etc mkdir /foo/foo3/etc mkdir /foo/foo4/etc ...but it appends '@' to each folder name and then fails on the subdirectories. Is it better to use a... (2 Replies)
Discussion started by: kamur
2 Replies

3. UNIX for Advanced & Expert Users

MV files from one directory structure(multiple level) to other directory structure

Hi, I am trying to write a script that will move all the files from source directory structure(multiple levels might exist) to destination directory structure. If a sub folder is source doesnot exist in destination then I have to skip and goto next level. I also need to delete the files in... (4 Replies)
Discussion started by: srmadab
4 Replies

4. Shell Programming and Scripting

Need help in Directory Structure

I have writen the following code to show the dirctory structure. Can any body help me for using the recursive function in this code? echo "-(0)" echo "$HOME-(1)" cd ~ set * for i in `ls $HOME` do if then echo ".....${i}" cd... (5 Replies)
Discussion started by: murtaza
5 Replies

5. Shell Programming and Scripting

Script to remove all empty files within the directory structure?

Hi I need to write a shell script which basically searches for all the empty files within the directory structure, lists them before asking the user to confirm if they would like to delete them. If the user deletes the file then a notice would appear confirming the file is deleted. I've be... (5 Replies)
Discussion started by: cat123
5 Replies

6. UNIX for Dummies Questions & Answers

Directory Structure

Hi... I have a directory which has multiple directories and sub directories inside... what command should i use to get a list of all these directories, without the filenames.... (2 Replies)
Discussion started by: saharookiedba
2 Replies

7. Shell Programming and Scripting

Shell script for a writing the directory structure to a file

Hi All, I am new user of shell scripting has come up with a problem. that I have a directory structure like : Home | |--------A | |----trunk | |-------A_0_1/ | | | |-------A_0_2/ | |--------B | ... (6 Replies)
Discussion started by: bhaskar_m
6 Replies

8. Shell Programming and Scripting

printing a directory structure

Hey everyone I am just trying print a directory structure but I am not getting the desired output. I am using AIX. Script : input file contains : TNP\\ECOM\\test\\1 input_file=folders.txt cat $input_file | while read line do echo $line done (3 Replies)
Discussion started by: rocker_me2002
3 Replies

9. Shell Programming and Scripting

Create Directory structure

Hello ; ) again Now I have my file like this : DIR2/DIR3 DIR2 DIR2/DIR3/DIR4/DIR5 I am looking for help to create a loop that will create the directory structure. I need something like this : If "DIR2" does not exist > Create IF "DIR2" exist already > check if onther "DIR"... (5 Replies)
Discussion started by: Aswex
5 Replies
IRSEND(1)							   User Commands							 IRSEND(1)

NAME
irsend - basic LIRC program to send infra-red commands SYNOPSIS
irsend [options] DIRECTIVE REMOTE CODE [CODE...] DESCRIPTION
Asks the lircd daemon to send one or more CIR (Consumer Infra-Red) commands. This is intended for remote control of electronic devices such as TV boxes, HiFi sets, etc. DIRECTIVE can be: SEND_ONCE - send CODE [CODE ...] once SEND_START - start repeating CODE SEND_STOP - stop repeating CODE LIST - list configured remote items SET_TRANSMITTERS - set transmitters NUM [NUM ...] SIMULATE - simulate IR event REMOTE is the name of a remote, as described in the lircd configuration file. CODE is the name of a remote control key of REMOTE, as it appears in the lircd configuration file. NUM is the transmitter number of the hardware device. For the LIST DIRECTIVE, REMOTE and/or CODE can be empty: LIST "" "" - list all configured remote names LIST REMOTE "" - list all codes of REMOTE LIST REMOTE CODE - list only CODE of REMOTE The SIMULATE command only works if it has been explicitly enabled in lircd. -h --help display usage summary -v --version display version -d --device use given lircd socket [/var/run/lirc/lircd] -a --address=host[:port] connect to lircd at this address -# --count=n send command n times EXAMPLES
irsend LIST DenonTuner "" irsend SEND_ONCE DenonTuner PROG-SCAN irsend SEND_ONCE OnkyoAmpli VOL-UP VOL-UP VOL-UP VOL-UP irsend SEND_START OnkyoAmpli VOL-DOWN ; sleep 3 irsend SEND_STOP OnkyoAmpli VOL-DOWN irsend SET_TRANSMITTERS 1 irsend SET_TRANSMITTERS 1 3 4 irsend SIMULATE "0000000000000476 00 OK TECHNISAT_ST3004S" FILES
/etc/lirc/lircd.conf Default lircd configuration file. It should contain all the remotes, their infra-red codes and the corresponding timing and wave- form details. DIAGNOSTICS
If lircd is not running (or /var/run/lirc/lircd lacks write permissions) irsend aborts with the following diagnostics: "irsend: could not connect to socket" "irsend: Connection refused" (or "Permission denied"). SEE ALSO
The documentation for lirc is maintained as html pages. They are located under html/ in the documentation directory. lircd(8), mode2(1), smode2(1), xmode2(1), irrecord(1), irw(1), http://www.lirc.org. irsend 0.9.0-pre1 October 2010 IRSEND(1)
All times are GMT -4. The time now is 09:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy