Move files based on year of creation


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Move files based on year of creation
# 1  
Old 07-10-2008
Move files based on year of creation

Hi All,

I have a directory which has crores of files since from 2003 till now. I want to move only the 2003 files to another directory. Please help.
Thanks
# 2  
Old 07-10-2008
You are looking for trouble:
Rules:
(4) Do not 'bump up' questions if they are not answered promptly. No duplicate or cross-posting and do not report a post or send a private message where your goal is to get an answer more quickly.
# 3  
Old 07-13-2008
Hi All,

Let me give the solution by myself.

Anyways! Thanks...

# !/usr/bin/ksh

cd CurrentDirectory
for i in `ls -ltr|awk '$8=="2001"{print $9}'`
do
mv $i NewDirectoryPath
done

exit 0
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to move files and Creation of folder structure

We are receiving few zipped files in one location say : apple/oranges/incoming All .zip files are placed here in incoming folder. So few of the files are password encrypted. There are only 10 zipped files, so we are planning to create a script which will pick that zip file from incoming... (1 Reply)
Discussion started by: Sidhant
1 Replies

2. Shell Programming and Scripting

Bourne returning files based on creation date

I'm wanting to write a bourne shell script that takes in two command line arguments - a directory and a file. With this I want to return a list of files within the directory that are older (based on creation date) than the given file, and print the number of files that have not been listed (they... (4 Replies)
Discussion started by: britty4
4 Replies

3. Shell Programming and Scripting

Moving files based on file creation

Hi, I have a directory having so many number of files. Now I want to move the files which are older than one month (lets say) from this directory to another directory (say BKP dir). Simply, if file is olderthan one month move it from source1 dir to BKP1 dir. My file names doesn't have... (7 Replies)
Discussion started by: karumudi7
7 Replies

4. Shell Programming and Scripting

Move files from one directory to another based on creation/modification date

Hi All, Really stuck up with a requirement where I need to move a file (Lets say date_Employee.txt--the date will have different date values like 20120612/20120613 etc) from one directory to another based on creation/modification dates. While visiting couple of posts, i could see we can... (3 Replies)
Discussion started by: dsfreddie
3 Replies

5. Shell Programming and Scripting

copy files based on creation timestamp

Dear friends.. I have the below listing of files under a directory in unix -rw-r--r-- 1 abc abc 263349631 Jun 1 11:18 CDLD_20110603032055.xml -rw-r--r-- 1 abc abc 267918241 Jun 1 11:21 CDLD_20110603032104.xml -rw-r--r-- 1 abc abc 257672513 Jun 3 10:41... (5 Replies)
Discussion started by: sureshg_sampat
5 Replies

6. Red Hat

Move files of a certain year to other directory

Hi all, I have a massive amount of recording files in .WAV format stored in a directory, files dating back to 2006. It is a huge amount of files as Linux cannot even do a listing of it all, it states: "argument list too long" What I would like to do is the following: Find all the files of... (6 Replies)
Discussion started by: codenjanod
6 Replies

7. UNIX for Dummies Questions & Answers

Move files based on year

Hi All, I have a directory which has crores of files since from 2003. I want to move ony the 2003 files to another directory. Please help (9 Replies)
Discussion started by: IHK
9 Replies

8. UNIX for Dummies Questions & Answers

Move files based on year

I have a directory which has crores of files since from 2003. I want to move only the 2003 files to another directory. Please help in doing this. Thanks (1 Reply)
Discussion started by: IHK
1 Replies

9. UNIX for Dummies Questions & Answers

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! :D (1 Reply)
Discussion started by: dgoyea
1 Replies
Login or Register to Ask a Question