Basically what i want is this but in a for-loop..
echo `date +'['%H':'%M':'%S']'` - `mv -vf test* test/` > log.txt
This works as i want except that it print everything on a single line. I want it to make a new line and a date stamp for every file moved.
Right now i get:
[10:12:36] - "test1.txt" -> "test/test1.txt" "test2.txt" -> "test/test2.txt" "test.txt" -> "test/test.txt"
But want:
[10:12:36] - "test.txt" -> "test/test.txt"
[10:12:37] - "test1.txt" -> "test/test1.txt"
[10:12:38] - "test2.txt" -> "test/test2.txt"
I guess i will need a for-loop to solve this but have not been able to figure it out. I also do not want to use variables as i want it on a single line. But that might not be possible?
Correct answer provided by Mat was:
for i in `mv -vf test* test/` ; do echo `date +'['%H':'%M':'%S']'` - $i ; done > log.txt
You could try: