In this Post I will discuss how to create random files using Linux bash script and how to remove files. For Example If you need to remove logs created for project you can write bashscripts to remove log files.First script create log files and second script remove the log files.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| #!/bin/bash
DIRECTORY_NAME="/home/sajithv/scripts"
cd $DIRECTORY_NAME
while :
do
CURRENT_TIME=`date +%Y-%m-%d:%H:%M:%S`
echo "Create Files at $CURRENT_TIME."
touch "SampleFile$CURRENT_TIME.txt"
sleep 5
done
|
Happy Coding...
No comments:
Post a Comment