Ubuntu :: Sequentially Number Files Based On Date Modified - Rename Cli

Nov 8, 2010

Sequentially number files based on date modified (rename cli)

I'm almost done a larger script which takes all the pictures in a folder, converts it to video, and emails it to me. Everything worked fine until I realized the picture filenames weren't always starting at 1, then ffmpeg chokes.

I have a bunch of files in a folder which I need to rename to:

I don't want to install any additional packages and I'd like this to run in a single command if possible.

If not possible, then a bash script would work too.

View 3 Replies


ADVERTISEMENT

Programming :: Rename Several Files Sequentially?

Apr 12, 2011

I am trying to rename some files that do not have a pattern in their names to a sequential names. original file names are in the form of REC92837498, REC9837449 and so on. I want to rename them to REC_1, REC_2...etc.

I used the following script:

Code:
j=1
for i in $(ls -rt REC*)
do
/path/${i} /path/REC_${j}

[Code]....

View 4 Replies View Related

Ubuntu :: Sequential Number To Date Rename?

Jan 4, 2010

I'm looking for some help for renaming files that contain a sequential number. The files are spoken word radio programs that have a sequential program number. I want to have a date in the file name ie. Pgm 3028 Abcxyz 2010-01-18.mp3. Here's a catch, the program only air Mon-Fri, yet I want all the programs to play in sequenceDoes anyone know of a script out there that can do this? I don't have programming knowledge to do myself.

View 2 Replies View Related

General :: Get Week Number Based On Date With Different First Day It In Gawk?

Jun 24, 2011

How to get the week number in linux using gawk with different first day of the week? the date command can give me the week number with +%V but it is based on Monday (1-53) or +%U (based on Sunday, 0-53).

I tried to to do this: date -d "ddmmyy+2days" +%V, but the result is not correct. I want the first day of the week is based on Saturday.

View 1 Replies View Related

Ubuntu :: Backup NTFS Files Modified After A Certain Date?

May 14, 2010

I clone my entire notebook hdd once a month to a USB drive with an identical disk once a month using dd. I would like to find a way to automatically or manually do incremental backups at shorter intervals.

The first problem is that my incremental backup drive is not the same as my full backup drive (which is my clone). Is there some way to backup or copy all files on a document partition modified after a certain date?

The second problem is that my document partition is NTFS-3G. I guess this could be done pretty easily using "dump" if I stored my docs on ext. [I don't because I want to make sure that my docs are accessible from any machine (say in an Internet cafe) should my MacBook die and I need to rip out the hard drive and run to do my homework on another system; that is why I keep my docs on my Vista partition].

View 1 Replies View Related

General :: Find All Files Modified In Date Range

Apr 30, 2010

I need to know all files modified within a date and time range.E.g: All modified files between 20 April 2010, 1100-1200 Hrs."find / -mtime +10 ! -mtime +11" :: this i found for date but how to include time as well.

View 2 Replies View Related

General :: Script To Display Modified Date&time Of Files?

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

Software :: Application To Eliminate Doubles In Files / Rename Changed Files With Date?

Jan 12, 2011

I have bought an external usb hard drive on which I back up my three computers every once in a while.Space will quickly be used up.I can't find that little bit of research that I need yesterday.Here is what I would like to find:An application that eliminates doubles in identical files and renames files that have changed by appending the last saved date yyyymmdd to the file name.Does such an application already exist?

View 6 Replies View Related

Fedora :: Rename JPG Files To Creation Date

Sep 2, 2009

I have a list of .jpg files from two cellphones that I would like to rename to the file creation date... but so far I can't seem to find a suitable script (or anything remotely close to what I need).

These are jpg's snapped on cellphone cameras, so no EXIF data exists.

View 4 Replies View Related

Ubuntu :: Rename Files - Add Number To All In Folder ?

Feb 14, 2010

Getting together a script that will add numbers to all the files in a folder.

I've ripped most of my CDs to oggs for my new pmp, but I found that the pmp doesn't like files that are numbered just as 1 and 2, as it thinks that the 2 is more than 10.

So instead of going through all of my music folders and renaming every file by hand from 1 to 01 and from 2 to 02, I'd ask if there's a script that can be executed to add these numbers for me. It'd be even better if it only added the number to the files with only one digit.

Here's an example:

I want to rename:

And I'd like to do it to all single-digit files lower than 10 in the folder, if possible. If not, I can isolate them by hand.

View 4 Replies View Related

Programming :: Rename Files Based On Database Entry?

Jul 8, 2010

I was hoping to get some pointers on how to rename files based on database entry. I got hundreds of thousands of files that has GUID name assigned to it. only way to find out the file name is to look up the database table. Its obvious that this is not efficient. I couldn't find any tutorials on how to do this. Please point me to right direction. A starting point would be very helpful.

View 1 Replies View Related

General :: Bash Script Rename Files Based On Directory Name?

Mar 26, 2010

I'm pretty new to bash scripting, but I really want to wrap my head around it.What I'm trying to do is: From directory "A": Go in to all subdirectories and rename all files within icrementally according to the directory name. SO:

|-- Varian
| |-- FB1-page132.pdf.png
| |-- FB1-page133.pdf.png

[code]...

View 7 Replies View Related

Programming :: Sort Files In Directories Based On Files Date

Sep 8, 2009

I need a script that will take all the files in a given directory and create new monthly sub-directories and sort all the files based on the creation date into the appropriate directory.For example, all files created between 01/01/09 and 01/31/09 will be placed in 'JAN-2009'

View 5 Replies View Related

Programming :: Bash-code To Rename Files Based On Config File

Apr 12, 2010

I'm writing a bash shell script that among various other things will traverse through a directory with hundreds of files and rename those who match a pattern found in a config file. It's expected that only about one in ten files will actually match, and those who don't, will simply just be ignored for this purpose.

This should for instance cause the file "dBase program file December 1987.prg" to be renamed "Clipper source code December 1987.prg", and conversely "C++ source August 1996.cpp" to be renamed "C source code August 1996.cpp" etc.A sample file such as "Random Data File.dat" should not be renamed here since it's not mentioned in the config file..What is the quickest, most elegant way to do this in bash?I am thinking of using bash's built-in regex matching combined with the /bin/rename utility, but don't quite know how to get started to catch this..I guess there are plenty ways of doing this in perl and elsewhere as well, but since this has to integrate into a pre-existing bash script, that's what I'm looking for.Anyone out there with a spare moment to offer a hint in the right direction?

View 14 Replies View Related

Ubuntu :: Renaming Video Files Based On The Date Created

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

General :: Finding Files Based On Date Without Using `find`?

Aug 11, 2011

I know find can do what I am looking for, but I am wondering if there is an alternative way to find files on the filesystem either created before/after a certain point, or at a certain time.

Typically I rely on updatedb & locate for most of my file searching needs. Issues with those tools, though, are that it only has directory and file names, and it only creates a database of local directories, not anything mounted via CIFS|NFS or via -o loop (eg, .iso images).

So if I need to find files created after yesterday across the entire system (local and remote filesystems), I am currently needing to use find.

What other tools, if any, would accomplish this in a similar fashion?

I have tried ls and grep, but that requires (in my attempts so far) multiple searches:

ls -lR | grep Aug | grep 10
ls -lR | grep Aug | grep 11

View 6 Replies View Related

Programming :: Copy All The Files In The Directory Based On The Modification Date?

Dec 29, 2010

Originally Posted by Kenny_StrawnPlease wrap [CODE] tags aroung any code posted here. The full source that way could still be posted.I am trying to copy all the files in the directory based on the modification date (i.e created on Dec 29). Not able to find the proper command for this. This is what I have tried.

(none) login: root
#
# cd /mnt/hd/

[code]...

View 8 Replies View Related

Ubuntu :: Deleting Files Based On Number Created (or In Folder?)

Jul 21, 2011

I'm dipping my toes into some bash scripting and was wondering if there was a way to delete a file not based on how old it is, but rather how many other files are currently in the folder... or something to that effect....

What I'm doing is creating a script to back up a folder nightly. I'd like to keep a maximum of 3 backups. However in case the script for some reason fails to run one night (computer turned off possibly) I don't want to set the condition for deletion to be the date.

I know that if I run:

Code:
find /path/to/files* -mtime +3 -exec rm {} ;
that it will delete everything older than three days. -atime and -ctime don't seem to be what I"m looking for... is there another command I can use to achieve what I"m trying to?

View 5 Replies View Related

General :: Use Date With Touch To Create New File With Date Based Name?

Mar 12, 2010

I am using CRON to create a new, blank file, every minute, in a specific location on my web server. After web searching, and reading man pages, I get the impression that the following command is supposed to work:touch /home/mydomain/var/folder/attachments/`date +%H%M`.txtThis should give me a new file with a file name that is the current hour and minute.However, when executed, the CRON mailer reports:touch /home/mydomain/var/folder/attachments/`date +/bin/sh: -c: line 0: unexpected EOF while looking for matching /bin/sh: -c: line 1: syntax error: unexpected end of fileSo, it looks like shell is seeing the plus (+) sign as an EOFObviously, nothing get created.What would be the easiest, single line command to create an empty file, at a given location, with a time based file name

View 5 Replies View Related

Software :: Join 2 Text Files Based On First Number Present In Every Line Of The 2 Text Files?

Jan 22, 2010

I have 2 text files : file1.txt and file2.txt

cat file1.txt

15 this is a sentence containing various words and spaces
34 this is a another sentence containing various words and spaces

cat file2.txt

2 this is sentence1file2
6 this is sentence2file2
54 this is sentence3file2

I would like to join these 2 files. The result should look as follows :

cat joinedfile.txt

2 this is sentence1file2
6 this is sentence2file2
15 this is a sentence containing various words and spaces
34 this is a another sentence containing various words and spaces
54 this is sentence3file2

==> so the joined file must be sorted on the first number. Any ideas how this can be achieved ?

View 4 Replies View Related

Software :: Rename Hidden Files / Rename All Files With A Leading Decimal Point Recursivley?

Jul 25, 2011

How would I rename all files with a leading decimal point recursivley? I some how got all my music files to have a decimal point.I tried the below and got a " sed argument to long".[CODE]find /media/MUSIC -type f -name "*.wma" | xargs -0 sed -i 's/.(.*)/1/'[CODE]

Another question, can i just use -type f with out -name ? I am sure that all the files got the decimal point added as the first character.

View 14 Replies View Related

General :: Find And Sort Results By Date Modified

Jun 7, 2011

so I was wondering how I could do a simple find which would order the results by most recently modified. Here is the current fine I am using. (I am doing a shell escape in php, so that is the reasoning for the variables. find '$dir' -name '$str'* -print | head -10

How could I have this order the search by most recently modified. (Note I do not want it to sort 'after' the search, but rather find the results based on what was most recently modified)

View 4 Replies View Related

Programming :: Script To Find Out Modified Date For Particular File

Jul 9, 2010

I am new to Scripting. I am trying to find out particular file is modified in last one hour or not in script and then if that file is modified in last one hour i need to copy that file to another directory.Can any one please provide me how to check the file is modified in one hour or not?

View 3 Replies View Related

Ubuntu :: 10.04 - 'Date Modified' Changed On File Copy To NTFS Partition?

Jul 6, 2011

Prior to making a fresh install of 10.04, I made a back up of all my documents by copying them to a NTFS partition. I did this my selecting files in File Browser, then right clicking and selecting the Copy command.

When I came to move the files back after the fresh install, I was mortified to find that all the file modification dates had changed to the date I copied them! I've lost all the original file dates, which was the principal way I sorted my files. I guess there's no way of getting it back? It seems that Linux does not store File Creation dates either so I'm stuffed.

View 3 Replies View Related

General :: Write Shell Script To Check The Modified Date Of A File ?

Jun 17, 2011

I have two linux servers, they are backup together.

1. Server 1 have 3 files with name: file1, file2, file3 in the path: /etc/sysconfig/network-script/.

2. Server 2 have 3 files with name and path are the same as server 1.

- How to make a script to copy 3 files at server1 to overwrite on server2. But before overwrite, this script will check and compare the last modified date of these 3 files(on server1 and server2). if the modified date of file1, file2 or file3 on server1 is newer than 3 files on server2 then overwrite process will do, if not, will do nothing.

- see my script as below: it works find now but just overwrite. not check last modified date.

View 1 Replies View Related

General :: Script To Execute A Command Based On The Last Modified Time Of A Folder

Oct 19, 2010

I need a script that executes a command based on a folder's last modified time.

if "/var/data" was modified in less than an hour then "/usr/local/etc/searchd stop" should be run

can we use "find -mmin +60 -type d" in conjunction with second command

View 1 Replies View Related

Ubuntu :: How To Rename File To System Date In Terminal

Nov 4, 2010

is there a way in terminal to rename a file to system date?

View 2 Replies View Related

General :: Copy To A New Directory And Rename With Date Stamp

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

Ubuntu :: Rotate Image (Script) Without Changing "modified" Date?

Nov 19, 2010

I am actually modifying someone else's script and I need some help. The original script rotated image files to the left but it changed the "modified date stamp" which is something I didn't want.

Code:
#!/bin/bash
while [[ -n "$1" ]]; do

[code]....

View 3 Replies View Related

General :: Sort And Rename Images By Date In EXIF Info?

Oct 31, 2010

I have a mess in my photos folder; I want to sort them according to date in EXIF information and rename according to the date (like 001.jpg, 002.jpg and so on).

How can I do this in Linux? I have used ImageMagick for some basic bulk processing tasks before (converting and resizing, etc), is it possible to use it for this task?

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved