![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|