SUSE :: Renaming Multiple Files - Adding Date / Time Stamp In Name
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
ADVERTISEMENT
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
Oct 10, 2010
how I should go about rotating files that end with a date stamp. This is the configuration I have to rotate my Apache access files, but it is not working:
/var/log/httpd/access_log.* {
compress
daily
rotate 1
copytruncate
missingok
notifempty
}
The files are created with a date extension like the ones below:
[Code]....
View 6 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 17, 2010
I often record music from the webradio with Streamtuner.How can I rename the mp3 files recorded in a way that numbers are added to the beginning of the filename representing the order in which the titles were played on the webradio station?I am looking for an automated solution like a renaming tool since there are usually hundreds of files in a directory. I used autorename / ARen for windows back in the day when I was still on XP. What I could do with the tool was:a) Sort the files by date of creationb) add an increasing number at the beginning of the filename based on the position in the sorted list.
View 3 Replies
View Related
Aug 4, 2011
I have hundreds of MTS and AVI files since 2000 and would like to rename them in the following manner based on the date created: DD-MMM-YYYY HH.MM.SS_X; where X begins at 1 and increments by 1 if there are dublicate date/time stamped videos.
Ex: 19-Nov-2002 08.12.30.avi, 19-Nov-2002 08:13:30_1 and 19-Nov-2002 08:13:30_2
Someone previously wrote the following script for me, and it works great for photos. It uses EXIV2 to get the image date created info. I have tried to understand the script, but am struggling. The video files I have can use the date modified since I have not modified them since I filmed them.
#!/usr/bin/env python
import os
import stat
import pyexiv2
import time
directory = '/home/david/Desktop/test'
[Code].....
View 1 Replies
View Related
Jan 11, 2011
Whenever I download a file using Firefox or Google Chrome and it has a ' character on it's filename, the file is renamed and a is added before the '. It's really annoying and I'd like to know how can I solve this issue.
View 9 Replies
View Related
Jan 8, 2011
I need to rename some files. They are named:
NP1-1.mp3
NP1-2.mp3
NP1-3.mp3
[code]....
However, as there is no lead 0, the order gets confused by some software (some software mistakenly lists it as NP1-1.mp3, then NP1-10.mp3). I'd like to add zeros so the files are named like this:
NP1-0001.mp3
NP1-0002.mp3
NP1-0003.mp3
[code]...
How can that be done?
View 3 Replies
View Related
Jun 21, 2011
I have many pdf files which contain "%" sign also in the name. I want to rename that all files by replacing "%" to "-" Its hierarchy of many files and folders. Is there any solution to do this at one time? OR any script for this?
View 7 Replies
View Related
Jul 20, 2011
Recently I installed Dropbox on a server to do file synchronization and it added " (Case Conflict 1)" to a whole bunch of my files! I realize now that it was caused by case insensitivity but I'm still left with hundreds of files that are in this renamed state. Is there a script in Linux that would allow me to recursively go through the directories and strip out this string?
i.e.
a (Case Conflict 1).jpg --> a.jpg
/myfolder/abc (Case Conflict 1).doc --> /myfolder/abc.doc
/myfolder/subfolder/mydoc (Case Conflict 1).pdf --> /myfolder/subfolder/mydoc.pdf
View 2 Replies
View Related
Apr 8, 2010
How can I copy multiple files, each with a slightly different name from the SOURCE in the same directory?
Example: '/home/junk' contains A.txt, B.txt
I want to copy /home/junk/A.txt to /home/junk/A1.txt and /home/junk/B.txt to /home/junk/B1.txt using a single command.
View 11 Replies
View Related
Feb 21, 2010
I have some random files in a folder. I want to rename all of the files in a batch process. I have a text file that contains the Currentname of all the files in the folder, as well as a text file with all of the Newname of files in the folder. I want to replace Currentnames with Newnames.
For example, here are the names of the files in the folder:
1.mp4
2.mp4
3.mp4
I have a text file with the Currentname of all the files in the folder:
1.mp4
2.mp4
3.mp4
I have a text file with the proper Newname of the file:
a.mp4
b.mp4
c.mp4
I want to rename Currentname with Newname in the folder. So when I go to the folder the Newname of the files are:
a.mp4
b.mp4
c.mp4
View 14 Replies
View Related
Mar 6, 2011
I have this cool bash script that I worked hard on. But it broke down when it can across files that had non-English characters. Another small problem was getting it to descend into a directory. If it renamed a directory it would not descend into that dir to rename the other files. I would have to run the script twice on the same directory.
Here is the script:
Code:
find -type d -o -regextype egrep -iregex '(.*.ogg|.*.mp3|.*.wav)' | while read s
do
rename -v 'y/A-Z/a-z/' "$s"
done
find -type d -o -regextype egrep -iregex '(.*.ogg|.*.mp3|.*.wav)' | while read n
do
rename -v 's/ /_/g' "$n"
done
A French name like this:
Code:
Chateau De Sable (imagine accents above the letter a)
became this:
Code:
ch303242tea_de_sable
This is not what I wanted.
Why would the script not descend into a directory after it was renamed?
View 7 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
Sep 17, 2010
I have some basic experiencing creating simple scripts/making directories/changing permissions/etc. but I'm stumped on this one.
I have two linux boxes. I have a script set up on box 'A' to SCP into box 'B', grab a copy of a database backup and store it on box 'A'. It looks like this:
scp root@X.X.X.X:/blah/blah/blah/dump.23.gz /home/blah/DB_Backups/
I have generated a public key on box 'A' and placed it into the authorized_keys file on box 'B', so a password is not required and the file copies over successfully when the script is run. On to my problem...
I need to know what date the 'dump.23.gz' file was originally created when I'm viewing it after it's been copied to box 'A'. If I ls -l on box 'A' it only shows me the date it was created on box 'A' when it was copied.
What would I need to add to my script to append the backup's original creation date on box 'B' to the filename so that when it gets copied to box 'A' I know when the backup was created on box 'B'. I'm sure this is probably confusing. I've done lots of searching and can only find information on how to append the current date and time to a file name. I need to append it's original creation timestamp to the filename when it copies over.
View 10 Replies
View Related
Mar 7, 2010
There are many time zone files accessible from the command line that don'thow up in the GUI ("system-config-time"). How do I add these time zones to the GUI
View 1 Replies
View Related
Jan 24, 2011
I just switched from a basic digital camera to a more advanced one that stores both Jpeg and Raw (.Nef - it's a Nikon) files for me.When importing files in Digikam, I rename the files so that they start with Date and Time. Example: 20110121-223748.JPG for a photo taken on Jan 21st 2011 at 22:37:48.I was a bit surprised when importing both the JPEG and the Raw version of the same photo, that the filename is different by a few seconds (no constant offset, sometimes they are the same):
20110121-223748.JPG
20110121-223750.NEF
I did some "research" by looking at the exif data of both files (using "exiftool 20110121-223748.JPG" from the command line). Here is what I got back
(amongst other data):20110121-223748.JPG
File Modification Date/Time : 2011:01:21 22:37:48+01:00
Modify Date : 2011:01:21 22:37:48
Date/Time Original : 2011:01:21 22:37:48
[code]....
So it seems that Digikam is using the "File Modification Date/Time" (different in the Jpeg's and Raw's of my camera) rather than the "Create Date" (the same for both Jpeg and Raw). (The few seconds difference in "File Modification Date/Time" between the two versions of the same photo is probably due to the time that my camera needs to write away the data on the SD memory card. I guess.) Is there a way to have Digikam use the Create Date? (Or the Date/Time Original?)
PS: I'm on Ubuntu 10.04LTS, using DigiKam 1.2.0
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
May 31, 2010
I am using the following script to creates list of accessed files.I like to add modified date and time of accessed files in the output.
For this what needs to be added in the below script??
#!/bin/bash
#
# creates list of accessed files
#
set $(date)
find /hdc160GB/programmers/projects -cmin -1440 > /hdc160GB/programmers/data/fileschanged/alert_$6-$2-$3.txt
View 7 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
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
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
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
Mar 18, 2009
I'm trying to find a proper command to move a certain set of files according to date/time range. I am thinking that the command should be something like:
Code:
ls -l | grep 'date/time range' | mv /folder
View 6 Replies
View Related
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
View Related
Aug 6, 2010
I am having a problem unzipping multiple files at 1 time.
Proper unzip command that will:
1) extract the file from the zip.
2) remove the zip file.
All my zip files start with SB and end with .emi.zip
SB*.emi.zip
View 2 Replies
View Related
Oct 29, 2010
I'd like to change a files modification date "only" without changing the time. I'm aware of the 'touch' command but is seems like it only allows changing both the date and time, and not one of them. Any ideas on an easy way to change a file's modification date without also changing its time? (I have a long list of files and thus would like to run one to command to change them all)Example: Change a file's (month) timestamp from "2010-09-23 11:59:23" to "2010-10-23 11:59:23"Background: I accidentally set the wrong month on my camera and ended up with all photos having a modification timestamp with the wrong month.
View 3 Replies
View Related
Oct 3, 2009
I've got fedora 11 set up to use network time protocol to sync my laptop's date & time when I'm on-line. The question is simple really, I've added a local universality's time server (what is public) and it's live. but it's added to the end of the default time servers what come with fedora. How do I get fedora to just use the local time server, is it a case of removing the default time servers for fedora, but there is a box what says advanced options which are. sync system clock before starting service ???? & use Local time source (( is that the same as the local ntp server that I've got set up ))Hope some body can help me with the network time protocol part of Date/Time settings.
View 9 Replies
View Related