Hi, I’m really struggling with this one!
I have a shell script that moves files from one location to another and that works fine, but what I want to do is… for every file that is moved I want to create an entry in a log file that has…
- the date and time the file was moved.
- the file name
- the file size
- the source folder
- the destination.
Can anyone help??
Thanks in advance
Dave
Do you want to do this by adding something to your shell script?
Ideally yes as I’m running the script via cron.
Hope this helps
There are lots of good on-line resources on Shell scripting.
Here’s what you need…
echo sends strings to stdout.
writes stdout to a file
appends stdout to a file
ls can provide file info
date to get current date & time
I assume you already know the source and target directory and file info.
so, for example,
echo date >> move.log
would append the current datetime to the file move.log