shell - Moving files older than 1 hour from one directory to another - AIX -
i trying move files older 1 hour, being populated every minute rapidly folder name specifies particular hour, in aix.
the script trying run is:
find /log/traces/ -type f -mmin +59 -exec mv '{}' /directory \;
the above script gives me error:
find: bad starting directory
i newbie shell scripting.
any highly appreciated.
------------------edited-----------------------
i have been able move files older 1 hour, if specified folder not exist, creates file name specified in command , dumps files in it. script running is:
find /log/traces -type f -mmin +59 -exec mv '{}' /directory/abc-$(date +%y%m%d_%h) \;
it creates file named abc-[current hour]. want create directory , move files it.
if not running root user may getting problem because of read permissions on /log/traces/
.
to see permission level of directory run ls -l /log/traces/
left column display drwxr-xr-x
explanation of permission settings directory has. understand more read this.
you need ensure user executing command has read access /log/traces/
- should fix error.
Comments
Post a Comment