General :: Change File Time Stamp (Bash Script)?
Jan 6, 2010
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?
View 4 Replies
ADVERTISEMENT
Jan 20, 2010
How do I change the time stamp on videos that I record so that they say what DAY they were recorded instead of just the DATE? I can't find the config file which I assume would be the place to look.
View 1 Replies
View Related
Mar 3, 2011
I have two systems running on linux. system one is running with RHEL 5.4/X86_64 hardware, system two is running with RHEL 5.3/i686 hardware. One filesystem is shared from system two and mounted as NFS on system one. Now when i do a copy from local filesystem to the NFS share from system one,it shows as follows
Quote:
-rw-r--r-- 1 xkinved rbak1 30 Mar 3 2011 king
But if i do copy with -p option then it shows right time stamp. Both machines are running with slight(minutes) different in time. Does this could be cause for this problem? The problem is happening while i do FTP from some other machines too.
View 3 Replies
View Related
Apr 13, 2011
I want to use history command to show the time stamp, user id, ip address, command logged
View 1 Replies
View Related
May 20, 2011
I was created one folder in linux with current time was 1978(For example). I was moved this folder to usb(FAT32 file format).While seeing this folder in window its not showing the folder time created time stamp, because the USB file system only support the year after 1980 . But again i am putting the same folder in linux ,its showing the correct time stamp.How is it possible? Because FAT32 only supports timestamp after 1980, but still its showing 1978 in linux system
View 7 Replies
View Related
Jul 12, 2010
I have this script in the past for csh: Code: ./a.out |& tee prints.txt which will redirect all printfs in the C program to the prints.txt file and at the same time show them in the console. How do you do this in bash? I have seen this, [URL] but it does not work for my bash and sh shells. It says:
Code: -bash: syntax error near unexpected token `&' and
Code: -sh: syntax error: unexpected "&"
View 2 Replies
View Related
Jun 2, 2010
I need to make a few folders, but I need the fold name to reflect the time which they were created. For example: if I create a folder at on 2010.06.03 at 13:01:34 then I would need a file name something similar to the following 20100603_130134. In addition, could the same method be used for .tar files? I would like a bash script which I can run to perform the following; however, I am not familiar with scripting in Linux yet.
View 2 Replies
View Related
Aug 9, 2010
I am trying to run prstat for an extended time, outputting to a file and appending a time-stamp to each line (running on Solaris 10). I have tried this:
prstat -c -U usrname 60 480 | nawk '$1=="PID" { "date +%d%m%Y-%H:%M:%S" | getline d ; close("date") } { print d,$0 }' > /tmp/fileName &
this only appends the time the command was started to each line. I would like to fix this so that a new time is recorded every 60 seconds.
View 1 Replies
View Related
Apr 8, 2010
I've been trying to use the stamp function in pdftk. I'm trying to stamp a pdf document with a pdf I generate on the fly that contains the current date. Below is what I have so far. The problem is that pdftk says "Error: failed to open stamp PDF file". the file is in the same dir as execution, I've made it 776, I've specified full paths... nothing seems to work. I've even tried the "prompt" option and specify it manually but I get the same behavior. This is pdftk version 1.4.
Script (named "go"):
Code:
# date in YYYY-MM-DD format
umask 0
# create a variable with a formatted date
TODAY=`date +%Y-%m-%0e`;
[Code].....
View 3 Replies
View Related
Feb 1, 2009
I am trying to rename multiple files in a directory and add the Date/Time stamp to the file name.
Example:
file1.txt
file2.txt
file3.txt
Renamed to
2009_02_01_21.txt
2009_02_02_21.txt
2009_02_03_21.txt
I am able to accomplish this using this command:
mv file1.txt "`date +%Y_%m%d_%H`".txt
But I want to automate this task, I have many files to process and I dont want to do them one by one.
I already tried this but it does not work
mv *.txt "`date +%Y_%m%d_%H`".txt
View 2 Replies
View Related
May 28, 2010
I tried following the example from here (http:url]......)Open up publicity.html for reading and writing by anyone.
Before: -rw-r--r-- publicity.html
Command: chmod og=rw publicity.html
After: -rw-rw-rw- publicity.html
Here's my terminal session:
username@ubuntu:/etc$ -rw-r--r-- bash.bashrc
-rw-r--r--: command not found
username@ubuntu:/etc$ chmod og=rw bash.bashrc[code]....
View 2 Replies
View Related
Feb 24, 2011
In the Windows world where I came from, Irfanview freeware easily renamed a large folder of JPEG photos by EXIF time & date stamps, appending a unique number if the time and date stamps were the same. Is there an equivalent rename-by-EXIF information batch command in Ubuntu 10.04 Lucid? For example, change (based solely on EXIF information): FROM:DSC_0001.JPG TO:20110224_09:34:56am.JPG
View 9 Replies
View Related
Jul 14, 2011
I'm trying to create a script that will look for a "filename" under /etc/, date stamp the file and copy it to /var/www/upload
View 5 Replies
View Related
Jun 19, 2011
Under a Linux shell, how can I change the creation time of all a folder's files to the current time?
View 2 Replies
View Related
Mar 24, 2010
I have a linux (Slackware) machine and the time/date is like, June 23rd 2003, 10:00am (It's 11 here) and I am not able to set the time to have it correct. I change the timezome to Montreal but the time is still wrong.
Is there a way to force it to sync with my domain controler or even another online NTP server?
View 1 Replies
View Related
Oct 23, 2010
So I have created a Bash script with the intent of the program to change the names of the files in a folder's subdirectory.The code recognises the individual subdirectories, then is able to enter into one and list the files individually, but when it tries to change their information it says;' cannot stat ' : ' No such file or directory 'As if it is looking in the directory that contains the Bash script, not its subdirectory.It is essentially saying, I see a file here called FILE but sorry, I can't change FILE because FILE doesn't exist. kweh?Is this something outside the capabilities of Bash? Am I asking too much of it? Can Bash only manipulate files that are in the same folder as the script?
Code:
#!/bin/bash
echo enter directory
[code]....
View 6 Replies
View Related
Mar 24, 2010
I want to change data format in a file using bash. The orignal is like:
Code:
1 abc 6 pqr
2 def 7 stu
3 ghij 8 vwx
4 kl 9 yz
[Code]....
View 9 Replies
View Related
Jul 15, 2011
Is there any way to change ubuntu one upload settings so that it only uploads 1 file at a time. I have slow upload speeds and the files don't always make it.
View 1 Replies
View Related
Nov 29, 2010
I create a bash script that writes another bash file. But in the generated bash file I want to write a bash command in the file and not executing it.Here's my bash file:
Code:
#!/bin/bash
cat > ~/generateGridmix2data.sh << END
[code]...
View 6 Replies
View Related
Jan 26, 2011
I'm having issue when trying to change a line in a file
[Code]....
View 1 Replies
View Related
May 18, 2010
Below is data taken from my dedicated server:
[Code]...
I need a script that I can run on an hourly basis that will:
1. Calculate the total downtime since the first date
2. The overall downtime percentage
3. Store this data in a file at /home/bla/file.txt, in the following format: TotalDowntime=03:02:02 Average=0.01%
View 2 Replies
View Related
Oct 25, 2010
Newbie 1st post here. Trying to find the most efficient way to copy a file to a different directory and rename it with a date stamp extension. Looking to accomplish this with one command if possible.
File = make_file
Full path /home/user1/bin/scripts/make_file
would like to move to the following directory /home/user1/bin/scripts/archive/
I'm trying to find out how to use command substitution along with the date command that when I copy the file to the archive directory it gets renamed with a time stamp extension. It should look something like "make_page_12:00:00-24-10-2010" I've tried a few different combinations using the cp and mv commands but can't seem to get it to work the way I want to.
View 3 Replies
View Related
Jan 8, 2011
From gui, how can I change my time from am to pm? or How to do it using date command?
View 7 Replies
View Related
Feb 2, 2011
I have one account on an Ubuntu server with the correct PS1 variable and I want to make one of my other accounts on the same server have the same PS1 variable, so that my prompt on this new account (when I ssh into the machine) is the same as the original account.
Is there a way that I can pass this PS1 variable between accounts so the prompt is the same?
I have tried printing it out, copying the output, and then reassigning it to PS1 on the new account, but it just doesn't work.
Here is what is printed when I type echo $PS1:
[e]0;u@h: wa]${debian_chroot:+($debian_chroot)}[�33[01;32m]u@h[�33[00m]:[�33[01;34m]w[�33[00m]$
I want to assign that prompt (shown above) to my new account.
View 2 Replies
View Related
Jan 25, 2011
I'm trying to change the bash prompt and based on the man pages $ should show a $ which changes to a # for a SU. However, this doesn't happen on my machine, it's $ for both user and SU.The line in .bashrc is:export PS1="u@h:w$"
View 7 Replies
View Related
Nov 11, 2010
I want to transfer files from one comp to another. Its a few hundred gigs. Since the pc crashed i am using knoppix to access the drive and sharing over samba.
I'm using robocopy to copy the files. But i have a small problem with sleep. Every 30mins or maybe an hour knoppix goes to sleep and my transfer stops. How do i change the time or disable it completely? so i dont have to tap a key every 30mins
View 1 Replies
View Related
May 28, 2011
How can I get the last time any of the files in a directory or its subdirectories has changed?
e.g
Dir - changed 1/1/1
Sub Dir 1 - changed 2/1/1
Sub Dir 2 - changed 3/1/1
File 1 - changed 10/1/1
File 2 - change 5/1/1
The output for this for Dir should be 10/1/1 (File 1 was the last modified one). Getting the last file name to be modified is a bonus but isn't necessary.
View 3 Replies
View Related
Jul 16, 2010
I need to change my hardware time and date as my hardware time don't right but I don't have network. I need the the commands and the steps.
View 5 Replies
View Related
Jun 21, 2010
i am using squid proxy on centos 5.x release with stable version. during installation time i fixed date time region.it was basicaly gmt +3:00 hours. so everything was fixed, now since past few days every 24 hours it change its time automaatically. this looks like it take update somewhere from internet or internally something is mess up.could someone guide me how to fixed permanantly date time. even either restart the machine or passing 24 hours it do never change it. etc
View 2 Replies
View Related
May 11, 2011
I am supposed to take some small files, and print them to a specific printer, such that the small files are concatenated into one file. The file name has to be included in the file that gets printed.
Should I be looking to concatenate the files into one file with the file names included, and then print them?
something like: -printfunction -printername < file*
View 7 Replies
View Related