The find -mtime 1 primary looks for files that are exactly 24 hours old. If you run two invocations of find a second apart, they will not copy the same file (if either of them finds any file at all).
If your script runs close to midnight every night and your daily file comes in around 6am every morning, you can get by with:
to copy files that are less than 24 hours old.
If you might get a file close to midnight (just before, while, or just after your script is run) or your cron job might not run every day (and you still want to copy each file exactly once), you could try something like:
You'll need to create /destdir/.previous with an appropriate timestamp before you run this script the first time, but after that it should do what you want. There is, however, a chance that a file will be copied twice (once today and once again tomorrow) if a file is created in /mydir while your script is running.
Hi Team,
I'm new to unix and i have a requirement to copy or move files from one directory to another based on current date mentioned in the .zip file name. Note that i need to copy only the recent zip file. please help me with the code
i tried the code as:
#! /usr/bin/sh
find... (3 Replies)
In the below bash I am trying to copy the only text file (always only one) in /home/cmccabe/Desktop/list/QC/metrics.txt and rename each of the 3 text files according to /home/cmccabe/Desktop/test/list.txt using lines 3, 4 ,5. This format (that is list.txt) is always 5 lines. Thank you :).
... (12 Replies)
HI,
Can anyone tell me how to pull the date and file name separated by a space using the find command or any other command. I want to look through several directories and based on a date timeframe (find -mtime -7), output the file name (without the path) and the date(in format mmddyyyy) to a... (2 Replies)
I have file listed like below
-rw-r--r--+ 1 test test 17M Nov 26 14:43 test1.gz
-rw-r--r--+ 1 test test 0 Nov 26 14:44 test2.gz
-rw-r--r--+ 1 test test 0 Nov 27 10:41 test3.gz
-rw-r--r--+ 1 test test 244K Nov 27 10:41 test4.gz
-rw-r--r--+ 1 test test 17M Nov 27 10:41 test5.gz
I... (5 Replies)
Hi Guys,
I have the following problem. I have original file (org.txt) that looks like this
module v_1(.....)
//arbitrary number of text lines
endmodule
module v_2(....)
//arbitrary number of text lines
endmodule
module v_3(...)
//arbitrary number of text lines
endmodule
module... (6 Replies)
Hi,
I need unix code to check the size of a file. for example if the size of the file in A folder is more than 1BM, then i have to move that particular file in to B folder whenever I run that particular script.
regards,
Srinivas. (7 Replies)
Hi,
I am new to unix shell programming.
I want to write a shell script for a functionality existing in mainframe system.
I have one file as below as input
123456
&__987
&12yuq
abcdef
_ referes to blank
condition:whenever the input file is having &__ ,it should be replaced... (4 Replies)
Hi I want to copy a file but append the date and time....how?
So copying the file file1.txt will have file1_20061009_0950.txt
I know the command :
date +"%Y%m%d_%H%M"
but how do i get this in the file name ?
cp file1.txt newDirectory/file1_?????????.txt
Thanx (2 Replies)
Hi,
I want to copy a some files according to the date.
lets say i want to copy file from june1st to june14th.
What is the command for that ?
Thanks,
Nayanajith. (1 Reply)