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 > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Sorting Files by date and moving files in date order rebel64 Shell Programming and Scripting 2 03-11-2008 12:45 PM
Count of files based on date? sbasetty Shell Programming and Scripting 6 01-11-2007 03:02 PM
Remove files based on date hshapiro UNIX for Dummies Questions & Answers 4 12-09-2005 12:21 PM
script to view files based on date krahuliyer Shell Programming and Scripting 6 10-05-2005 04:51 AM
Moving Files within a particular date range rooh UNIX for Dummies Questions & Answers 3 03-18-2002 10:59 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-28-2001
dgoyea dgoyea is offline
Registered User
  
 

Join Date: Jun 2001
Posts: 1
Question Moving files based on creation date

Howdy,

I'm trying to figure out how to move multiple files based on their creation date. If anyone can enlighten me it would be most appreciated!!

Thanks!

  #2 (permalink)  
Old 06-28-2001
Optimus_P Optimus_P is offline Forum Advisor  
flim flam flamma jamma
  
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
Code:
case "$1" in

'-d')

DIR=${2:?"bad or missing Directory"}
CREATE=${3:?"missing Creation Date"}
NEWDIR=`echo $CREATE|awk '{ print $1$2 }'`

for creationdate in $DIR ; do
        if [[ -d $NEWDIR ]];then
                mv `ls -l|grep "$CREATE"|grep -v $NEWDIR|awk '{ print $9 }'` $NEWDIR
        else
                mkdir $NEWDIR
                mv `ls -l|grep "$CREATE"|grep -v $NEWDIR|awk '{ print $9 }'` $NEWDIR
        fi
done
;;

*)
        echo
        echo "Usage: $0 [-d] <directory/to/search> <Date to look for>"
        echo "Example: $0 -d /home0/user \"Jun 28\""
        echo
;;
esac
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 11:18 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