Programming :: Bash Script To Copy Modification Date From A File To His Folder?
Jul 29, 2011
I need this script but I don't know how to do it I have one folder with several folders inside.On each folder a have one MKV or AVI file inside...What I need is a script to change the "modification date" of each folder to the "modification date" of each MKV or AVI that the folder has inside.
View 16 Replies
ADVERTISEMENT
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
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
Mar 23, 2011
I need to be able to compare a file date with system date and delete files older than 30 days.
the file name is basically
error_log.03222011
of course the extension is the date the file was created.
Oh and before i get hammered I looked everywhere but am unable to make sense of what I found.
View 3 Replies
View Related
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
Jun 8, 2010
It seems to be simple one, but couldn't figure out exactly. Say I copy a file preserving its original modification time using the command
Code:
cp -p file1 file2
Now later, I want to know when file2 was copied... How do I find it ?
View 1 Replies
View Related
Dec 16, 2010
I have files and folders various permissions.I copied the files and folders to X server.But I forgot to copy of the permissions.Like is hereHow can restore the permissions?
View 3 Replies
View Related
Mar 12, 2010
I have a directory and sub-directories (4 or 5 depths). There are several type with extension in them (*.mp3, *.wma, *.jpg, etc). I would like to copy the whole directory to another location recursively but only *.mp3 files.
View 11 Replies
View Related
Dec 5, 2010
I'm starting bash shell script and I'm looping without any solution.
I'm trying to find some files under a folder hierarchy and in case of errors moving these files to a destination folder under the same hierarchy recreating this hierarchy if not exists.
Finding all ._* files under /src and moving them to /dest recreating folder1 or the others which contains ._* files but without moving files which does not correspond to the pattern.
Code:
I tried find command and I'am getting all needed files
Code:
But I don't know how to use the output to get the parent folder of files which are found to
1- create folder with mkdir -p /dest/folder1 or /dest/folder1/folder4
2- move found files from /src/... to /dest/... with rm command
I'm working on a find command as this trying to do all in the same line but ... little lost
Code:
View 8 Replies
View Related
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
Sep 15, 2010
I like ordering my images my date modified, but Eye of GNOME only lets you view them by alphabetical order.
Important features for me are: Going through items with the arrow keys. Zooming in and out with the mouse wheel. Being able to sort by modification date, type, or name. Being able to right click and open with either another window of the same viewer, or with another viewer. Having a simple interface
So far, I've tried:
Eye of GNOME - I love how simple it is, and if it wasn't for this sorting problem I'd keep using it. Well, that and the fact that you can't right click and open an image in a separate Eye of GNOME window while continuing to scroll images in the current window.
gThumb - Damn. So close to being a winner. Can't pass images with the arrow keys or zoom in and out with the mouse wheel, but I can sort by modification date, it's simple, and can open another window of the same viewer. But those first two points are also important for me.
Fspot - A little too cluttered when opening a single image. I don't really need to see a top panel with the other images, even if it's nice. I can go through images with the arrow keys, and zoom in and out, but no sorting by modification date.
Shotwell - Shotwell's viewer is pretty fast and simple, however it has lots of flaws for me: can't sort by modification date, can't zoom in and out with mouse wheel, can't open an image in another window while viewing it. At least it's simple and I can navigate with the arrow keys.
View 4 Replies
View Related
Mar 25, 2011
When I go in a file with pictures and right click on it I tell it to arrange pictures by modification date but when I start viewing the pictures and click on next then it shows them to me in Alphabetical order.I am using Eye of GNOME 2.32.0 to view picturesHow do I get this application to show me the pictures by modification date
View 4 Replies
View Related
Dec 30, 2010
I am trying to find a command which will copy all the files in the folder with extension ".log" which is created one day before the current date. By going through other threads in this forum I found the half solution to this problem
find /mnt/hd -mtime -1 -exec scp {} /mnt/usb ;
This command copying the all the files created one day before(not only *.log) to the /mnt/usb folder. what is the modification required to above command.
View 5 Replies
View Related
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
Jun 22, 2011
I have used "FILENAME="`TZ=$TZ+24 date +%y%m%d`" in a bash script that run in openbsd. What my script does is to changes a file name to "yesterdays date". I tried to use it in a script that runs in debian but it doesnt work. Is there any other command that i can use in debian?
View 3 Replies
View Related
Aug 2, 2010
I need to convert strings in the format YYYYMMDD to dates so I can perform date arithmetic.
View 4 Replies
View Related
Mar 11, 2010
I've recently inherited a bunch of files at a new job and am trying to figure out some of the problems that have constantly popped up. The one i'm getting a huge headache with results from a bash script that is supposed to change a date format from a client populated txt field to one we want defined a certain way. Everything in the script works fine, except that one function. Below is the line i'm trying to manipulate, with date examples.
sed -e 's/.0000 EA/ EA/' -e 's/ 01012010 / 01-JAN-2010 /' -e 's/ 12312011 / 31-DEC-2011 /'
The one caveat is that the first date is non-static and changes daily. It is, however, always the current date. If it helps, the second date will always be a year away from the first date.My idea was to pull the current date via perl's DATE function, but...how to do it, and calculate a year away without throwing the rest of the bash script off? Any help would be appreciated. I'm sure it's a simple solution but i know absolutely nothing about these scripts and how they were written.
View 10 Replies
View Related
Dec 1, 2010
When i want copy a file or folder in some system folder like sbin,Etc.show me error about privilage but when I'm in console i use su command for become admin and i can copy my file or folder.in other operation system like windows user can copy anything,i want know for direct copy my folder in linux without console what should i do? i must join my user name in root group?
View 4 Replies
View Related
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
May 7, 2010
I wrote this little script and I need some help, I am trying to achieve following:Every day I receive new file in the /home/denis/MyData/ folder and I don't know what the file mane will be but I want to move any file that arrives there to the new location /media/DataBackup/Linux/backup/ (media/DataBackup/ is external 500GB USB drive)to automatically create new folder with the date and time stamp every day and then to move content of the /home/denis/MyData/ into the new folder with current date stamp. So every day there will be new folder and will contain files for that day only.My script is as follows:
cd /media/DataBackup/Linux/backup/
mkdir MyData_$(date +%Y%b%d_%HH%MM)
#this creates file MyData_current date and time
[code]...
View 3 Replies
View Related
Aug 1, 2011
As a photographer I'm constantly taking photos and storing them in folders. Now occasionally I'm using two cameras (either for different settings or an assistant is also taking photos) which means that for one event I can have differently named images.Both cameras have the same time set (which always helps in Windows) but in Ubuntu when trying to sort my folder by date taken I can't.The options I'm given are to sort them: Manually, by Name, by Size, by Type, by Modification date and by Emblem.Now none of those are helpful to me once I've done a few edits to the images.So please if anyone knows, how do you organise a folder with images taken on different cameras by Date Taken rather than Date Edited?
View 3 Replies
View Related
May 13, 2010
I have this code:
Code:
original_content=${content[@]};
echo ${#content[@]} # is 23
echo ${#original_content[@]} # is 1
I'd expect original_content should be copy of content. How to copy array?
View 2 Replies
View Related
Jul 13, 2011
I have a lot of filenames (strings) following the same convention
m02_+1+7_London_0000$01.cfg
m02_+1+8_London_0000$01.cfg
m02_+1+8_London_0000$01.cfg
[code].....
What I want to do is to create a script that will interpret the following string and save into variables part of its name
m02_+1+7_London_0000$01.cfg as
------X-Y--City---------
X=1
Y=7
City=London
[code]....
then I want to copy the files that go all the files with the same City and X and Y to the same subfolder City/MX.Y I will need some help start doing that. And I think the first would be to get part of the filenames strings into variables.
View 3 Replies
View Related
Oct 21, 2010
i have one questions :"bash copy filename destin_dir"1- i need a bash script to copy file from one directory to another , and if the destination directory have the same file name, add '_1' to the file name ..and if there is a file with 'filename_1' , add '_2' to the file name and become 'filename_2' and so on
View 5 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
Mar 29, 2010
I have to copy some log files with a cron job; I'd like to copy only the newer files added because I run the script with a weekly cron. all the log files are named like "10-03-29.CVS" and reside in a dir. When I copy I'd like to copy only the files not already copied with the last cron job.
View 8 Replies
View Related
Mar 12, 2011
I tried to write a cron job in Fedora13 as follows
#!/bin/bash
today='date +%d%m%Y'
cp /var/www/html/site1/module.txt /home/amitha/Desktop/backup/$today.module.txt
[code]....
View 3 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
Jul 19, 2009
I am doing my web radio project. i hav the exact code for the application. It needs sland and newt libraries to be installed. I installed them succesffuly. but when i compile the code it is showing number of errors. actually i hav to copy the libnewt.so file into /usr/lib folder. when i copy tat file it is displaying error as permission denied.
how to copy that file in to that folder. and tell me the stteps to install newt on fdora core 9.
the errors displayed when i compile the code are
[root@localhost newt-0.52.4]# cc -Wall -I/usr/include/slang -D_GNU_SOURCE -g -c -o setup.o setup.c
setup.c:4:18: error: newt.h: No such file or directory
In file included from setup.c:10:
newt_pr.h:20: warning: enum newtFlagsSense declared inside parameter list
newt_pr.h:20: warning: its scope is only this definition or declaration, which is probably not what you want
[Code].....
View 5 Replies
View Related
Nov 20, 2010
I need to copy a file from my desktop to a system folder but unsure how. It needs to go to the "etc/X11" folder
View 6 Replies
View Related