Hi,
These are the list of files in one directory in the server :
[root@L28tstream1 ~]# ls -lrt
total 10120
-rw-r--r-- 1 root root 4484 Jul 8 2011 install.log.syslog
-rw-r--r-- 1 root root 51890 Jul 8 2011 install.log
-rw------- 1 root root 3140 Jul 8 2011 anaconda-ks.cfg
drwxr-xr-x 2 root root 4096 Jun 26 2012 ESA_Inst_pkg
drwxr-xr-x 2 root root 4096 Jun 29 2012 Desktop
-rw-r--r-- 1 root root 89153 Jul 9 2012 POST.zip
drwx------ 2 root root 4096 Nov 25 2014 Mail
drwxr-xr-x 2 root root 4096 Jul 8 2015 test
drwxr-xr-x 2 root root 4096 Aug 17 2015 scripts
-rw-r--r-- 1 root root 19133 Mar 18 2016 snmpd.conf.18032016b4changes
drwxr-xr-x 3 root root 4096 Mar 21 2016 hp-agent
-rw-r--r-- 1 root root 19093 Mar 30 2016 snmpd.conf
-rw-r--r-- 1 root root 1282865 Apr 22 2016 hp-snmp-agents-9.50-2564.34.rhel5.x8 6_64.rpm
-rw-r--r-- 1 root root 737366 Apr 22 2016 hp-health-9.50-1631.33.rhel5.x86_64. rpm
-rw-r--r-- 1 root root 1064960 Apr 22 2016 hpacucli-9.40-12.0.x86_64.rpm
-rw-r--r-- 1 root root 3644843 Apr 22 2016 hp-smh-templates-10.4.0-1455.24.noar ch.rpm
-rw-r--r-- 1 root root 3334099 May 17 2016 hpadu-9.40-12.0.x86_64.rpm
-rwxr--r-- 1 root root 39 Apr 19 14:04 script.sh
drwxr-xr-x 2 root root 4096 Apr 19 14:23 2017
-rwxr--r-- 1 root root 202 Apr 19 14:34 script1.sh
drwxr-xr-x 2 root root 4096 Apr 19 14:50 Apr2017_Blast_BC15
-rwxr--r-- 1 root root 164 Apr 19 14:52 script2.sh
-rwxr--r-- 1 root root 147 Apr 19 17:43 script3.sh
[root@L28tstream1 ~]# pwd
I want to move only specific files from this folder to another folder. Let's say I choose only files dated 'Apr 19 14:04' to 'Apr 19 17:43'. This is the command I run to execute this task :
[root@L28tstream1 ~]# find . -type f -newer "2017-04-19" ! -newer "2017-04-20" -exec cp {} /home/emoaigin/ \;
find: 2017-04-19: No such file or directory
[root@L28tstream1 ~]#
However as you can see, I get the error above. ' No such file or directory
'. How do I choose files with specific dates to move to another directory?
This is important as I need to create a script that moves files from a set date in a month. So far I need to move files dated every 2nd, 8th and 16th onwards, (but the end date is not fixed, which is why I need a script that selects files from the dates mentioned onwards) and move it to another directory. If this were not the case, I know I can use 'mtime' to move the files.