The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Create a file from within a script lamano Shell Programming and Scripting 2 03-04-2009 04:31 PM
can we create a GUI by shall script johnray31 Shell Programming and Scripting 1 07-24-2007 11:47 AM
create a text file in a script n8575 UNIX for Dummies Questions & Answers 2 02-07-2006 12:38 PM
how do I create an ftp script leonard905 UNIX for Dummies Questions & Answers 2 01-14-2005 06:25 AM
script to create tar file ajrandrup UNIX for Dummies Questions & Answers 2 12-03-2003 01:06 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-25-2008
paparazi paparazi is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 2
Create file in script

I am trying to create a new file(string) with todays date in a backup folder

string= `date '+%d%m%y'`
find [a-z]* [0-9]* [A-Q]* /home/SMB-2000/* -print |cpio -ovm > /home/bkups/$string

After excecuting I get the messege

# ./b2
250208
./b2: /home/bkups/: cannot create

Where am i going wrong?
  #2 (permalink)  
Old 02-25-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,315
Remove the ">" in the cpio command:

Code:
find [a-z]* [0-9]* [A-Q]* /home/SMB-2000/* -print |cpio -ovm /home/bkups/$string
Edit:

I think I'm wrong, you don't use the -p option so the redirection is correct.
Do you have write permission in the directories?

Regards

Last edited by Franklin52; 02-25-2008 at 03:54 PM..
  #3 (permalink)  
Old 02-26-2008
paparazi paparazi is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 2
I have root rights

I am doing this as root user. Additionally I have ensured maximum permissions on bkups directory
  #4 (permalink)  
Old 02-26-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,315
The directory must be exist, try to make the directory before the find command:

Code:
mkdir -p /home/bkups/$string
Regards
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:22 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0