[VIEWED 4616
TIMES]
|
SAVE! for ease of future access.
|
|
|
jhapaliketo
Please log in to subscribe to jhapaliketo's postings.
Posted on 02-08-11 11:58
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
I have written the following script to copy files from a directory to another directory and add time stamp to the copied file and remove the original file. I want to know if it is good for bash scripting.
#!/bin/bash
for FILES in ./current/*
do
cp -ur $FILES /previous/${FILE}.`date +%m%d%Y`
rm ./current/$FILES
done
|
|
|
|
M$Hacks
Please log in to subscribe to M$Hacks's postings.
Posted on 02-09-11 11:11
AM [Snapshot: 65]
Reply
[Subscribe]
|
Login in to Rate this Post:
1
?
Liked by
|
|
I woud recommend using move instead of copy+remove, its faster. Modified version below:
#!/bin/bash
cd ./current
for FILES in *
do
mv $FILES /previous/${FILES}.`date +%m%d%Y`
done
|
|
|
jhapaliketo
Please log in to subscribe to jhapaliketo's postings.
Posted on 02-09-11 12:57
PM [Snapshot: 110]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
That looks good.
Thanks
My VPN is not working. So, i have not been able to test.
|
|