I just need to consider files which are created on current month taking year into consideration because my script will trigger on every month or when ever the script trigger take current month files
Using a fixed -mtime value might get more files than you are expecting.
Try creating two reference files with touch and specify the timestamp as a date that will set delimiters for the age range of your files, then use find to get the files modified between the two reference files.
Would this approach help? What have you tried so far?
You haven't told us your OS version, so do you have the GNU date available so you can do date -d 'yesterday' and similar things?
We can probably help you achieve what you want, but you need to be clearer in the specification.
Please become accustomed to provide decent context info of your problem.
It is always helpful to support a request with system info like OS and shell, related environment (variables, options), preferred tools, adequate (representative) sample input and desired output data and the logics connecting the two, and, if existent, system (error) messages verbatim, to avoid ambiguities and keep people from guessing.
Try
and don't complain date doesn't work this way on your system as you didn't mention any details of that...
EDIT:
Use $(date -d"${1:0:7}-01 +1month) for touching C2 as this will create it at midnight of next month's first, so that last month's entire last day is taken into account.
could you please assist the below query.
i had written the below piece of code to copy the files from one directory to another. For current month files had been copied ,unfortunately the previous month files not copied.
Please find the below directory structure:-
ls -lrt
total 1824... (2 Replies)
Hi,
I need all file names in a folder which has date >= 10th of last month,
Example
: files in folder
AUTO_F1_20140610.TXT
BUTO_F1_20140616.TXT
CUTO_F1_20140603.TXT
FA_AUTO_06012014.TXT
LA_AUTO_06112014.TXT
MA_AUTO_06212014.TXT
ZA_AUTO_06232014.TXT
Output:
AUTO_F1_20140610.TXT... (9 Replies)
Hi,
I want to display the file names and the record count for the files in the 2nd column for the files created today.
i have written the below command which is listing the file names. but while piping the above command to the wc -l command
its not working for me.
ls -l... (5 Replies)
Hi All,
I need to find all files other than first two files dates & last file date for month and month/year wise list.
lets say there are following files in directory
Mar 19 2012 c.txt
Mar 19 2012 cc.txt
Mar 21 2012 d.txt
Mar 22 2012 f.txt
Mar 24 2012 h.txt
Mar 25 2012 w.txt
Feb 12... (16 Replies)
hello everyone,
I am new to perl script and trying to develop a script as follows.
I am trying to Create an array for storing all file names. I am trying to copy $libs into "scratch". however i am unable to do so. Please suggest..
#!/usr/bin/perl
use File::Copy;
#use... (5 Replies)
Hi, I have a requirement to copy files from a windows network drive to a Linux server using shell script based on the last created date.
Ex:
FileName CreatedDate/Time
F1 05-01-2012 3:00 PM
F2 05-01-2012 3:15 PM
F3 05-01-2012 2:00 PM
When i run the shell script... (1 Reply)
I need to copy a file example hhh.txt to the recently created directory by name flexite@latesttimestamp in the path interface/home/ ...
I couldnt get the name of recently created directory ....
first result of ls -lst ...that is ls -lst |head -2 gives the latest directory but i could not... (2 Replies)
Hi all,
I like to get two date values from command line, and I have to copy all the files created in between that dates in a particular folder to destination folder. The date comparison is little bit consusing me. Please help.
Regards
Sethu. (2 Replies)
hi,
i m new to unix.
I have been trying to find all the files in my home directory and its subdirectories that are created in the month of september.
Can anyone please help me with this??? (1 Reply)