I've already tired to try to solved this problem. Also search in Internet didn't find anything solution
I have a directory like this :
I want to move each file into directory /opt/projects/backup/"yearmonthday".
for example, I want to move all file which has time stamp Apr 23.
so, 1.txt,2.txt and 10.txt will move to /opt/projects/20100423.
pliz....help me!!!
Last edited by sunardo; 09-24-2010 at 10:48 AM..
Reason: change "yearmonthdate" to "yearmonthday"
yes vbe. But it just example. .
There are many files with different time stamp. Total 3627460 files in my directory and it all have different time stamp, randomly, without pattern (not just Apr 23), from Apr 23 until now
so, I want to make script to move file to /opt/projects/backup/'yearmonthday'
In my opinion it can, using
so before move the file, firstly the script will create directory /opt/projects/backup/'yearmonthday' based on files' timestamp. Then move each file into /opt/projects/backup/'yearmonthday'.
Anybody can help me to make this script?
I ve tried to move some file in March with :
But as you know it's waste my time and my energy to do that.
Have you looked into the options for the FIND command? It is not completely clear what environment you are workign in, but between date and find you should be able to loop through and move the files on that basis. Shell is actually the difficult way to do this. It would, I believe, be easier in a PERL script.
There is much variation in date-related commands in unix and Linux. Please state what Operating System and version you have and what Shell you use.
Btw. You do not have Total 3627460 files in your directory. That figure is a size not a count.
If you want to count the files:
Now, because the format of a date stamp changes for older files, do you have any files more than say eleven months old?
This problem is very difficult if you start from the output from "ls -la".
Do you have the "stat" command and know how to get a file timestamp from that command?
@wpeckham...I just have a few Perl background...
or maybe you can show me the example
@methyl
thanks a lot.
Till now, i've never use stat command...
---------- Post updated at 03:14 AM ---------- Previous update was at 02:29 AM ----------
Til now here is my progress, I tried in another PC,
So, firstly generate the directory based on files timestamp
and dump(redirect) it's output to a file and make it executeable.
Another simpler way is pipe it to another shell instance
The second, move the file into the directory created before
Plis, CMIIW with my script.
find /app/data -name "Availability" -
Below is the output now i need to filter based on latest modified timestamp.
I know 3 is the latest modified time stamp but i tried different options but only filtering docs and not on headnote..Can any one tell me how to do that..
... (2 Replies)
Hi All,
I am facing small problem.
i want to print file time stamp on which date file has placed in the server.
i have given some code but its not giving the year.
any help appreciated.
regards
rajesh. (4 Replies)
Hi all,
I'm after some help with this small issue which i'm struggling to work out a fix for.
I have a file that contains records that all have a time stamp for each individual record, i need to search the file for a specific time stamp and then search back 10 seconds to see if the number... (2 Replies)
Hi,
I'm trying to improve my Unix skills and I'm wondering what is the best way to move some files based on filetype and attributes like time created?
For instance, lets suppose I have a directory with many different files in it and I'd like to move all the jpgs that were created between May... (6 Replies)
Hi All,
PFB is a requirement. I am new to shell scripting. So plz help. It would be highly appreciated.
1. choose all the log files based on a particular date (files location is '/test/domain')--i.e,we should choose all the files that are modified on 29th November, neither 28th nor 30th
2.... (3 Replies)
Hi,
As i know , we can change the time stamp of a file by touch command, i did change in a file and it is looking as given
# ls -l abcd
-rw-r--r-- 1 batsoqa sicusers 0 Feb 17 2010 abcd
actually i want to see the output like this
-rw-r--r-- 1 batsoqa sicusers ... (3 Replies)
Hi
I have to move files between file systems but files in new file system must have the same attributes as in old one (privileges, time stamp etc).
Which tool is best :
- ufsdump / ufsrestore
- tar
- cpio
- pax
- dd
- mv
Or maybe there is sth else, you suggest to use.
Thx for help (5 Replies)
Hi All,
I know the timestamp of a file. Now i would like to list all the files in the with the same time stamp in the same file.
Any help would be appreciated.
Thanks.
sunny (1 Reply)
Hi Everyone,
I want to delete some files in a path based on the time stamp of the file that is i want to delete the file once in a month.
Can any one help me on this?
Thanks in advance (2 Replies)
i want to copy a filea.dat to a file name in the format
of filea_yyyymmdd_hhmi.dat
using something like DTSTAMP=$(date "+%Y%m%d"),
which puts it in format filea_yyyymmdd.dat (5 Replies)