General :: Adding A Files Creation Date To It's File Name?

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


ADVERTISEMENT

Ubuntu Multimedia :: Replace Jpg Files Last Modification Date With Timestamp Creation Date?

Sep 22, 2010

I'm looking for a method for modifying some jpg photo files last modification date with the corresponding timestamp creation date of each file.The reason is that shotwell import pictures in folders according to last modification date which is stupid on my opinion.

View 2 Replies View Related

General :: Merge Files By Creation / Modification Date?

Oct 4, 2010

I have a folder with hundreds of .txt files (logs of some java application) that I have to merge in to one single .txt file. This application produces a new log file everyday:

day1: logFriday10September2010.txt
day2: logSaturday11September2010.txt
...
day8: logFriday17September2010.txt
...
and so on...

I could merge the files easily with "cat" and ">>" however, the problem is that I have to do it by taking into account the date (creation or modification) of the file.

If I simple use the cat command the output file will receive for example, all Fridays in a row, then all Saturdays, etc. and in that way I'm not considering the date.

I've searched for the options of the find command, since the files after creation are not modified...I try to use this for example:

$ find . -newer <some old file>

but that lists me all files after that <old file> and not by correct date.

View 5 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 :: List Files By Creation Date?

Aug 19, 2010

I'm looking for a terminal command that gives me the latest created folder in a directory tree.

Code:

ls -lR --sort=time --reverse

this i almost good, but a) it gives me files (rather than folders only), b) it sorts the files by folder (rather than just giving me a plain list of everything) and c) it takes way to long.

what i want:

Code:

2010-08-01 ./path/to/folder/a
2010-08-03 ./path/to/folder/b
2010-08-06 ./another/folder/c

[code]....

View 9 Replies View Related

Programming :: Writing Unix Shell Script To Pass File Name/path/creation Date?

Oct 7, 2009

I'm new to UNIX scripting; I�m stuck with the following I have an Oracle SQL script that takes three parameters

1- File Name
2- File Path
3- File creation date

Under UNIX I have a folder where files will be placed frequently and I need to upload those files to Oracle, what I need is a UNIX script that can do the following

Loop through Directory "/home/applmgr/snktmp"
Picks only files
Pass the file name to parameter &1

[code]....

Is the above possible? I already knows how to call the Oracle Script from UNIX Im only stuck on writing the UNIX part where it List the files attribute(name,path,date) and store them to parameters ,Looping until the last file in the directory If the above is not possible,then how can I create the below from the command line

Filename{concatenation Mark}filePath{concatenation Mark}creationdate
Filename{concatenation Mark}filePath{concatenation Mark}creationdate
Filename{concatenation Mark}filePath{concatenation Mark}creationdate
Filename{concatenation Mark}filePath{concatenation Mark}creationdate

View 4 Replies View Related

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 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 :: Change Creation Date Of .mpg / .avi Videos In Digikam?

Feb 16, 2010

I am using Ubuntu 9.10 and have been using digikam to get my photos and videos in order. A lot of the creation dates are messed up, but I have been using the "adjust time and date" tool in Digikam to ge the photos set to their correct creation date.

However, when I try to do that on a .mpg or .avi I get an error that reads "Unable to adjust metadata in ****.mpg" I've tried opening the videos in other programs, like avidemux and cinelerra, I even tried opening the properties section of the videos. I haven't been able to find a way to modify the creation date of videos.

Is there a way to change the creation date of videos on Ubuntu? I would prefer to use digikam, but at this point I'm open to anything. Do I need to download a plugin? A program? Use a command line command?

View 4 Replies View Related

Ubuntu :: Creation Date For Directories Isn't Stored Or At Least Couldn't Find It?

Feb 19, 2010

i'm trying to make a script that gives one output if a directory in /home is older than one month, and another if the directory is less than one month old. I looked around and saw that the creation date for directories isn't stored, or at least i couldn't find it? How is this possible to do then?

View 2 Replies View Related

Ubuntu Servers :: Folder And File Creation - Can't Successfully Share Editable Files Between Users

Feb 18, 2010

I'm trying to setup a Samba share for our work. I have it almost complete, however I can't successfully share editable files between users. The issue I'm having is that say User1 create a file test.txt, because of the 755 permissions, then User2, who has "writable" rights as per the smb.conf file, cannot edit that test.txt file.

Whevener I create a file with a user, its locked by that user. Is there a way I can set it that every folder/file a user creates is 777 ? I firgured that there's still security because of the "Valid users = " field in the smb.conf file.

View 9 Replies View Related

General :: CentOS ISO Creation From OS Files?

May 9, 2011

I have CentOS 5.5 Operating System files copied from the DVD, it's not a ISO image. My Centos dvd is not working so, I would like to make bootable image and burn it on a DVD from the files and install CentOS on other machine. I have tried creating ISO image using mkisofs command but, it is not booting.

View 6 Replies View Related

General :: Forbid Removal Of Files But Allow Creation Of Them For Specific Directory?

Jun 14, 2010

I have an application that creates temp files and quickly deletes them. But I'd like to keep those files, is there a way to do that in Linux?

View 2 Replies View Related

Programming :: Keep Original Mod Date Of A File And 'date' It Back To Same File?

Jul 12, 2010

I would really like to preserve a file's original modified date and pass it back to the file as the same attribute after a script has worked on it. I get a lot of JPEG files from different places on the Net which I either turn around and upload or burn to disk, and having the "original" date of either download or last mod in a graphics app would be for me, in the long run, a lot more helpful when deciding, for instance, which files to "recycle" or pass on backing up more than once.I've tried doing this on my own every now and then. Where I run into problems is that it appears "stat" and "date" use different formats for date information, and I can't seem to puzzle out how to "translate" one to the other satisfactorily for the latter command.

Just to give an example:
stat foo.jpg |grep Modify gives me
Modify: 2010-07-12 06:28:56.890625000 -0400

Passing that string as-is to date foo.jpg, I get the errordate: unknown option -- 0 and the usual semi-courteous suggestion to Try 'date --help' for more information.Somehow my TexInfo database got screwed up somewhere along the line and info dategives me the short article on date input formats, not the full documentation for the command

View 4 Replies View Related

General :: Create File With 751 Permissions At Creation

Apr 5, 2011

I keep creating practice perl scripts in a linux directory using vi <filename> and need to chmod 751 <filename> before I can run it as I wish to. I'm sure there is a simple way to default my permissions or config them at creation, but I'm not familiar with it ayuda me por favor.

View 2 Replies View Related

General :: Extract The File Creation Time?

Nov 23, 2010

I want to extract the file creation time. How to get it. I am using fedora core 4

View 3 Replies View Related

General :: Add Some Starting Information In A File While Creation?

Apr 7, 2010

I want to add some starting information in a file while creation. like if I type vi test.sh

then
#!/bin/bash
will be added automatically.

Somebosy suggest me how to do this ??

View 22 Replies View Related

CentOS 5 :: Modify The ISO File By Adding Few Files

Jan 14, 2010

I need to modify the ISO file by adding few files so that after all installation done I can run a sh script to do some thing on the box. How to do that?

View 4 Replies View Related

General :: Assigning New Creation File Time On Tar Extraction?

Nov 19, 2010

How I can tell tar to assign a new creation date to extracted files? Let's say I have an archive filled with old files of varying ages. Upon extraction I want all files to have the same time stamp (that of the time of the extraction).

View 1 Replies View Related

General :: Real Time File Creation In Terminal?

Aug 2, 2010

I was wondering if there is a command to show a real-time creation of files. I basically executed a command that will created thousands of files and takes a long time. I want to check if it is still creating additional files or if ti got frozen.

View 3 Replies View Related

General :: Shell Scripting Text File Creation ?

Feb 16, 2011

I'm just starting out with shell-scripting, but having a problem with making new text files with the touch or cat > commands.

What I've been doing is touch testfile1.txt

Also, I've tried cat > testfile1.txt (text)

Console reports "bash: text1.txt: No such file or directory. Consfusingly, it works fine in the home-directory. But if I move the file to where I want it, I can no longer view, edit, etc. it.

View 1 Replies View Related

General :: Parsing File Dates - Get The Date Of The Last Time A File Was Modified ?

Jan 11, 2010

I need to get the modified date on a file in linux to use in a script.I tried using 'ls -l' on the file, but this caused problems when the date turned from a single digit into a double. The reason for the problem was because I was parsing the result string on spaces.How can I get the date of the last time a file was modified so I can use it in a script? For example, if a file was modified on 1/11/2010, I need the 11.

View 2 Replies View Related

Server :: Adding The Expiry Date In Freebsd?

Jun 28, 2011

I have a freebsd server and I want to add the expiry date through the normal user(not through the su).

View 2 Replies View Related

Ubuntu :: Adding Widgets Or At Least The Date To The Top Bar In Unity?

May 8, 2011

In Ubuntu 10.10 one was able to add widgets, such as the full date (not just the time) to the top bar in Gnome. Can you do this in Unity? I like being able to quickly look at the bar and see the date (I'm forgetful) but all that is there is the time. I do miss not having the applications bar where you can look and see just what applications are running and quickly cycle between them. Right now I need to mouse over the dock (and sometimes do a little mouse dance) to open it and then scroll down it to access something that is open and happens to be at the bottom of the list. I felt that having the bar exposed was more efficient, although maybe not as elegant looking.

View 2 Replies View Related

General :: Deleting Files By Date

Nov 5, 2009

I had a program run riot and it has created hundreds of spurious files in one directory. Fortunately they are all dated 4th November so are easily identified. What bash command can I use from the console to delete them all?

View 2 Replies View Related

General :: Untar And Only Extract Those Files That Are Above A Certain Date

Jun 16, 2010

Is there any way to untar and only extract those files that are above a certain date including directory structure??

I restored a backup on a play server but it was a few days old. However I have a tar archive of the entire structure that is more up to date and healthy so now I want to extract all files (including directory structure) based on a date filter on the files if possible?

View 2 Replies View Related

General :: Copy Files Revised After A Certain Date?

Feb 15, 2011

I am running ubundu 10.10 and want to copy all files revised after a certain date (01.02.2011) to a certain location (usb memory stick) for backup purposes. How do I use the "cp" command, or do I have to use any other command ? Or may be this is not possible in Linux ?

View 1 Replies View Related

General :: Find Files In Date Range?

May 31, 2010

ls -l /tmp/empty_file*
-rw-r--r-- 1 root root 0 2010-05-30 08:00 /tmp/empty_file
-rw-r--r-- 1 root root 0 2010-05-30 12:00 /tmp/empty_file1

This looks good, the files expected to be seen are output: find /usr ( -newer /tmp/empty_file -a ! -newer /tmp/empty_file1 ) -print

But this shows me files that should not be output and likewise when I replace ls with tar it is tarring a whole bunch of stuff I do not want: find /usr ( -newer /tmp/empty_file -a ! -newer /tmp/empty_file1 ) -exec ls -l {} ;

In the end I would like to replace the "ls" with "tar cvvfp some.tar {} ;", but can't figure out what is going wrong here.

View 2 Replies View Related

General :: Rsync Files With Dates After A Certain Date?

Jun 8, 2010

I was going to do a rsync -r -a -z -v -p -e sshto move some files frome server to another, but then realized all I really need are files which have dates starting June 1, 2008 to current. Is there a way to have rsync only sync those files?he directory structure that's my source goes all the way back to 2004.

View 5 Replies View Related

General :: Put The Date In The Name Of File But Can't Seem To Get?

Apr 11, 2011

I'm trying to put the date in the name of my file but cant seem to get it I just end up with the word date in the file instead of the date. my script looks like this.

#!/bin/bash
x="/var/log/system/"
y=date
z=${y:11:8}
top > $x$y.txt

View 3 Replies View Related







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