The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
Replace a filename with full path using sed aksaravanan Shell Programming and Scripting 2 10-06-2008 03:49 PM
Check valid records in really big file with one commend.. vtischuk@yahoo. Shell Programming and Scripting 3 05-18-2008 03:54 PM
Remove path from filename borgeh UNIX for Dummies Questions & Answers 3 08-23-2007 10:58 AM
How to check for a valid numeric input Vijayakumarpc Shell Programming and Scripting 1 08-04-2007 08:34 AM
how to check the actual path instead of link path reldb UNIX for Advanced & Expert Users 4 10-04-2006 09:55 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-03-2009
arukr arukr is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 2
to check whether a directory or filename path is valid or not

the script on excution should take a directory path from useran a numric input and it should check indicate whether its write or not?
if the cmmd sh<script-name>,dir/path.<500>" is greater than 500 in size should be copied to dir ,temp in pwd and display the mesage'files of 2000 bytes hav been copied to dir temp'
  #2 (permalink)  
Old 01-03-2009
cfajohnson's Avatar
cfajohnson cfajohnson is online now Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,318
Quote:
Originally Posted by arukr View Post
the script on excution should take a directory path from useran a numric input and it should check indicate whether its write or not?

Do you mean "whether you can write to it" or "whether it's right"?
Quote:
if the cmmd

What's "cmmd"? If you mean "command", please say so. The posts in this forum should be in plain English.
Quote:
sh<script-name>,dir/path.<500>" is greater than 500 in size should be copied to dir ,temp in pwd and display the mesage'files of 2000 bytes hav been copied to dir temp'

That sentence makes no sense. Please rephrase it. Where you have code, please put it in [code] tags.
  #3 (permalink)  
Old 01-04-2009
arukr arukr is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 2
I'm retyping the question as suggested

Script on execution should take a directory path from user and a numeric input.it should flag in case of input missing or wrong path .All files inside directory greater than a the numeric input specified should be copied to another directory temp .At last the total copied file size in temp should be displayed .
  #4 (permalink)  
Old 01-04-2009
cfajohnson's Avatar
cfajohnson cfajohnson is online now Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,318
Quote:
Originally Posted by arukr View Post
Script on execution should take a directory path from user and a numeric input.

Where does it get the numeric input? From the user? From the standard input? From a file?
Quote:
it should flag in case of input missing or wrong path .

How do you determine whether the path is right or wrong?

What do you mean by "flag"? Should the script exit or should it continue? Should it notify the user?
Quote:
All files inside directory greater than a the numeric input specified

How do you determine whether a file is "greater than the numeric input"? Are the file names all numeric? Or do you want to test the contents of the files?
Quote:
should be copied to another directory temp .At last the total copied file size in temp should be displayed .
  #5 (permalink)  
Old 01-05-2009
mosaic mosaic is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 9
is this one?

find $1 -size +$2c ! -type d | xargs ls -l |awk '{print $5}'

find $1 -size +$2c ! -type d | xargs -t -I{} cp {} /temp

the above shell can list the size in bytes of all the eligible files in the specified directory. and then write a loop to count the total size.
The second command can be used to copy the files to /temp directory.
Sponsored Links
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 09:53 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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