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
ADVERTISEMENT
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
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
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 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
Jun 7, 2010
I sorted a large mailing list and the result is in almost sorted order, but not quite.The sort was invoked in the default manner, just "sort".See (below) a segment of the output file.(Note: the actual files have a street address following each name.I have omitted the addresses to avoid complaints about disclosing personal information on-line.) I expect all people named KATZ to be grouped together, but they aren't. This phenomenon occurs elsewhere in the output file, so it has nothing to do with surnames beginning with the character string KATZ.
View 5 Replies
View Related
Nov 18, 2010
I am actually modifying someone else's script and 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 2 Replies
View Related
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
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
Sep 29, 2010
how to find the latest modified directory. I know that the command 'ls -rtl' gives the latest modified file/directory at the end. But my specific requirement is: If I create two directories named dir1, dir2 in the same order. so now my latest modified directory is "dir2". Now inside each directories, I created a file. Now in the last, I modify the file in "dir1". So overall, the content of dir1 got modified recently. If I use the command 'ls -rtl', this will still show dir2 as latest, as it is created recently. But I want the directory in which any internal content at any sub-hierarchy modified recently. so with what linux command I'll get this latest modified directory (dir1)?
View 3 Replies
View Related
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
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
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
May 29, 2011
I am a newbie in ubuntu. I did clamscan on my ubuntu /, and I got the result message as follow. it shows "486 errors" I am wondering if the result is OK or I need to do some action on it.
Known viruses: 968595
Engine version: 0.96.5
Scanned directories: 28067
Scanned files: 131696
Infected files: 0
Total errors: 486
Data scanned: 9020.40 MB
Data read: 17800.31 MB (ratio 0.51:1)
Time: 1349.479 sec (22 m 29 s)"
Also, my engine is 0.96.5. The latest version is 0.97. But "aptitude upgrade" can not upgrade the engine to 0.97. I understand 0.97 is still on testing. I am wondering if I can just stay with 0.96.5 and wait for the 0.97 passing all tests. if so, does it cause any security issue?
View 5 Replies
View Related
Aug 12, 2010
Code:
$ ls -l
-rw-r--r-- 1 username vuser 35553 Aug 9 18:15 note.20100809_1815.sql
[code]....
View 3 Replies
View Related
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
Nov 18, 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
#if a file and not a dir
if [[ -f "$1" ]]; then
#the images that I copy from my cell phone don't have exif headers #so I am using the -mkexif switch first to match the exif information #to the "created date" in the .jpg file. jhead -mkexif "$1"
[Code]...
It's important to note that the original script, before I made any edits, did not have this quirk whereas I needed to "touch" the file to get it to orient itself correctly. The 'original' script is in black; my additions are in blue.
View 4 Replies
View Related
Jul 15, 2010
It sure looks not quite sorted to me. See lines 3 and 4.
Code:
altair/root /root 250# sort -k1 < files.out | head -6
/bin base-files
/bin bash
/bin/bash bash
/bin bsdutils
[Code]...
View 9 Replies
View Related
Jan 22, 2010
I wanted to supply mplayer with the output of find command as arguments. The error returned showed spliced names of files whenever spaces occurred. I have subdirectories in my /home/my_user_name/Music/ directory, and in them multiple *.oga music files. The actual command that I issued was
Code:
mplayer $(find /home/my_user_name/Music/ -name "*.oga")
mplayer started but then was looking for broken file names. I am thinking quoting has to do with it to preserve the filename as one string but different attempts were met with inroads:
Code:
mplayer `find /home/my_user_name/Music/ -name "*.oga"`
gave me the same result and
Code:
mplayer `"find /home/my_user_name/Music/ -name *.oga"`
complained about wrong mplayer syntax.
View 1 Replies
View Related
Aug 12, 2010
I'm trying to do a
find /photos/* -type f -mtime +365
to find all my pictures that are over a year old, but I keep getting argument list too long. How can I view what all the results are, even if it just dumps it to a file that I have to open?
View 12 Replies
View Related
Feb 20, 2010
If I do something to the effect of this:ldapsearch -b "dc=example,dc=com" -x -z 3000
I'll get this back at the end of the result set:
# search result
search: 2
result: 4 Size limit exceeded
The thing is is that I have way more (thousands) than what's being displayed here. And I've tried to mess around with /etc/ldap.conf, changing the SIZELIMIT directive to something else, 10000, let's say, and restarting the server, but the same goddamn thing happens.
I've been messing around with this for quite some time now, hopefully someone will be able to shed some light on this so that I can learn my way out of this mess that is LDAP. Also in a related matter, I'm running Mint (based off of Ubuntu), and all the documentation that I've seen (probably read a good 100+ pages in a few days now on this) keeps telling me to make changes to my slapd.conf file. What slapd.conf file? It doesn't exist, I can't find it at least. find / -name slapd.conf turns up nothing.
View 10 Replies
View Related
Oct 22, 2010
How would i find the installation date of my OS.
View 5 Replies
View Related
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
Jan 27, 2011
I use RadHat Linu5.We usually log in to LINUX via putty (remote). Very often many people use the same user and password to log in.I wonder how to tell who has edited/modified a file?
View 9 Replies
View Related
Jan 27, 2011
I use RadHat Linu5.
We usually log in to LINUX via putty (remote). Very often many people use the same user and password to log in.
how to tell who has edited/modified a file?
View 9 Replies
View Related
Jul 11, 2011
I have a ton of files that are timestamped directories. These all look like2011-06-24_13.53.36 // a directory name for june 24th, 1:53:36 pmI have thousands of these directories. I want to do operations on some of the older ones. Let's say I give it a string for date time that matches that exact format, like i'll give it2011-06-25_00.00.00 // june 25th, 12amI want to find all the directories BEFORE my time. So if i give the string for 12am on june 25th, i want to find all the directories before then.If not i can find EVERY directory i have like this and then filter after wards. The created/modified dates are not tied to the actual timestamp im looking for (that would make this easier)
View 2 Replies
View Related
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
May 5, 2010
i have text file that filename contain the date of creation (i.e 2010.05.02.log).I would like to create a script that:-Ask for start date -Ask for end date- Concatenate all file on the requested period by date order.
View 1 Replies
View Related
Aug 7, 2011
Is there a script to do this? I have shotwell and want to find files that are going to cause problems with automatic sorting.
View 3 Replies
View Related
May 28, 2010
I need to write a script that is given a directory as an argument, and it prints the last modified file from that directory and all its subdirectories.
for example:
$ newest /usr/etc
--> /usr/etc/httpd/httpd May 28 12:16
If I had to do it only for the current dir, it would be easy...I'd probably use "ls -lt" and then show only the first line...
View 1 Replies
View Related