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
Moving all user files to another/new directory gav_dhiman UNIX for Dummies Questions & Answers 11 08-27-2008 07:35 AM
Moving files not directory. senthil_is Shell Programming and Scripting 1 05-09-2008 02:21 AM
Shell script for Creating Directory with name as system date aarora_98 Shell Programming and Scripting 7 12-07-2005 08:14 AM
How to Compress files before moving them in a directory godalle Shell Programming and Scripting 3 11-10-2005 11:59 AM
moving files from a unix directory to a windows directory gleads UNIX for Dummies Questions & Answers 2 08-29-2002 09:42 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 12-05-2008
ravi030 ravi030 is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 1
Creating date directory and moving files into that directory

I have list of files named file_username_051208_025233.log. Here 051208 is the date and 025233 is the time.I have to run thousands of files daily.I want to put all the files depending on the date of running into a date directory.Suppose if we run files today they should put into 05ec:08 directory. I would be verythankful if anybody suggest me the way to do it.

I did try for sometime,but not worked out for me
date_dir = `date +%d:%b:%y`

mkdir "${date_dir}"
In the starting of itself it scolding me like date_dir command not found
  #2 (permalink)  
Old 12-05-2008
manikantants manikantants is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 131
look at the space before and after the "=" sign
it should be date_dir=`date +%d:%b:%y`
  #3 (permalink)  
Old 12-05-2008
praveen kumar05 praveen kumar05 is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 3
Why Colons in between %d, %b,%y. It gives output like "05:\Dec:08", If you remove the colons and put the command like this
date_dir=`date+%d%b%y` This will give output like 05Dec08
  #4 (permalink)  
Old 12-05-2008
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,423
this will give the required date format

Code:
> date +"%d:%b:%y"
05:Dec:08

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 06:05 AM.


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