Sponsored Content
Top Forums Shell Programming and Scripting Changing File Time Stamp (Bash Script) Post 302384779 by chj on Wednesday 6th of January 2010 09:37:48 AM
Old 01-06-2010
Changing File Time Stamp (Bash Script) [SOLVED]

I need some help recovering from a "slight" screwup. We just moved 3 TB of data from one RAID Array to another. Low lever archive files. This was done with a regular cp (for some reason) and now we have lost all the timestamps on the files, and we urgently need to get the timestamps back on these files.

We are running Ubuntu 9.10 Server and we have mounted the following

1. /mnt/old-raid ##Old raid from the old server
2. /mnt/new-raid ##New raid on the server

I know we can read out the timestamp on the old server using the command stat -c '%Y' <<filname>>

I know we can change the timestamp of the file, using the command touch -d '<<date>>'

To get from the stat -c date to the input date in touch we need to use date -d @<<timestamp>> +'%d %b %Y %R'

So my question is, how can I create a loop that will list all files in a folder, get their timestamp and update the old timestamp with the new?

Clear as mud?

Last edited by chj; 01-06-2010 at 01:57 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

File date and time stamp

I have to capture the creation date and time stamp for a file. The ls command doesn't list all the required information. I need year, month, day, hour, minute and second. Any ideas... (1 Reply)
Discussion started by: Xenon
1 Replies

2. UNIX for Dummies Questions & Answers

How to MV without changing Time Stamp

Hi, I need to move the set of files, and it should be same time stamp as previous. How to do this? (3 Replies)
Discussion started by: redlotus72
3 Replies

3. Shell Programming and Scripting

how do i put a time stamp in a file name

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)
Discussion started by: jhamm
5 Replies

4. Shell Programming and Scripting

copying a file without changing date stamp.

Hi, I am using the below copy command, to copy the file sbn to sbn1, cp sbn sbn1 but its changing the date stamp of file sbn1, but i dont want to change the date stamp of sbn1. Could you please help me out in this. (3 Replies)
Discussion started by: shivanete
3 Replies

5. Shell Programming and Scripting

Change time stamp of a file

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)
Discussion started by: apskaushik
3 Replies

6. Shell Programming and Scripting

Run a script when a file is modified/time stamp changed

Hi, I need to run a script file which uses a file and that file is modified as and when some alarms generated, it is not based on any fixed time period.. it may be modified even once in a minute for some time and once in 30 min or once in 20 min. Hence i need to watch for the timestamp change of... (3 Replies)
Discussion started by: aemunathan
3 Replies

7. Shell Programming and Scripting

creating a file with time stamp

Hi guys, Here my scenario is to find the files of previous days if the previous day load had not done. for that i created a file with time stamp and this file is created after the load completes. so every dau i search for the this file with previous days time stamp. i want to create a file... (1 Reply)
Discussion started by: apple2685
1 Replies

8. Shell Programming and Scripting

file time stamp

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)
Discussion started by: rajesh_pola
4 Replies

9. Shell Programming and Scripting

Changing time-stamp with sed

Hi ! I try to change a time-stamp hh:mm:ss allways to full ten-minutes. example: 12:51:03 to 12:50:03 sed 's/::/:{0-5}0:/g' file.txt but it will not work propperly, because the minute-decade will be replaced with the bracket-term {0-5}. Can someone please give me a hint? Thanks in... (6 Replies)
Discussion started by: IMPe
6 Replies

10. Shell Programming and Scripting

Shell Script | Parse log file after a given date and time stamp

I am developing one script which will take log file name, output file name, date, hour and minute as an argument and based on these inputs, the script will scan and capture all the error(s) that have been triggered from a given time. Example: script should capture all the error after 13:50 on Jan... (2 Replies)
Discussion started by: ROMA3
2 Replies
extlinux(1)						      General Commands Manual						       extlinux(1)

NAME
extlinux - install the SYSLINUX bootloader on a ext2/ext3 filesystem SYNOPSIS
extlinux [options] directory DESCRIPTION
EXTLINUX is a new syslinux derivative, which boots from a Linux ext2/ext3 filesystem. It works the same way as SYSLINUX, with a few slight modifications. It is intended to simplify first-time installation of Linux, and for creation of rescue and other special-purpose boot disks. The installer is designed to be run on a mounted directory. For example, if you have an ext2 or ext3 usb key mounted on /mnt, you can run the following command: extlinux --install /mnt OPTIONS
-H, --heads=# Force the number of heads. -i, --install Install over the current bootsector. -O, --clear-once Clear the boot-once command. -o, --once=command Execute a command once upon boot. -r, --raid Fall back to the next device on boot failure. --reset-adv Reset auxiliary data. -S, --sectors=# Force the number of sectors per track. -U, --update Updates a previous EXTLINUX installation. -z, --zip Force zipdrive geometry (-H 64 -S 32). BUGS
I would appreciate hearing of any problems you have with SYSLINUX. I would also like to hear from you if you have successfully used SYS- LINUX, especially if you are using it for a distribution. If you are reporting problems, please include all possible information about your system and your BIOS; the vast majority of all problems reported turn out to be BIOS or hardware bugs, and I need as much information as possible in order to diagnose the problems. There is a mailing list for discussion among SYSLINUX users and for announcements of new and test versions. To join, send a message to majordomo@linux.kernel.org with the line: SEE ALSO
syslinux(1) SYSLINUX for ext2/ext3 filesystem 18 December 2007 extlinux(1)
All times are GMT -4. The time now is 04:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy