- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script to create 200 test files in my directory wi...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2000 11:38 AM
08-21-2000 11:38 AM
Does anyone know how to create a Script which will create 200 test files in my directory with a timestamp different by 1 second or so... I would greatly appreciate any help...
I believe this would be done with a For loop..
Shaun Aldrich
SAldrich@chaptersinc.com
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2000 11:53 AM
08-21-2000 11:53 AM
Re: Script to create 200 test files in my directory with a timestamp different by 1 second or so...
you can try something like this....
#!/bin/sh
i=0
while [ $i -lt 200 ]
do
touch file${i}
sleep 1
i=`expr $i + 1`
done
--Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2000 11:54 AM
08-21-2000 11:54 AM
Re: Script to create 200 test files in my directory with a timestamp different by 1 second or so...
count=0
while [ $count != 1001 ]
do
touch ./file.$count
sleep 1
count=`expr ${count} + 1`
done
Then just change the sleep line based on the time delay you want.
Hope this helps,
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2000 12:00 PM
08-21-2000 12:00 PM
Re: Script to create 200 test files in my directory with a timestamp different by 1 second or so...
#!/usr/bin/csh
@ count = 0
while ($count < 60)
if($count < 10) set count = "0${count}"
touch -t 082012${count} xxx${count}.tmp
touch -t 082112${count} yyy${count}.tmp
@ count ++
end
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2000 12:01 PM
08-21-2000 12:01 PM
Re: Script to create 200 test files in my directory with a timestamp different by 1 second or so...
i=`expr $i + 1`
What is the expr? Do I need to replace that with anything? Sorry about all the questions but I am really rusty on scripting...
Do I need to do anything else to it?
Thanks for you help...
Shaun Aldrich
SAldrich@chaptersinc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2000 12:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2000 12:06 PM
08-21-2000 12:06 PM
Re: Script to create 200 test files in my directory with a timestamp different by 1 second or so...
Hope this helps,
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2000 12:22 PM
08-21-2000 12:22 PM
Re: Script to create 200 test files in my directory with a timestamp different by 1 second or so...
Steve's right. It just increments the counter. It could be more sexy if you use csh or ksh.
--Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2000 12:31 PM
08-21-2000 12:31 PM
Re: Script to create 200 test files in my directory with a timestamp different by 1 second or so...
All of the responses given to your question do the job as you requested. At the risk of nit-picking, I thought that I might point out that the timestamps that you will see with a 'ls' command only show precision of one-minute.
If you aren't impatient, you could change the sleep interval to 60+ seconds. Otherwise, you could use the 'touch' command with its '-t' option to create files that you can more readily distinguish.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2000 12:46 PM
08-21-2000 12:46 PM
Re: Script to create 200 test files in my directory with a timestamp different by 1 second or so...
I just created the following script and called it test1.
#!/usr/bin/ksh
i=0
while [ $i -lt 200 ]
do
touch file${i}
sleep 1
i=`expr $i + 1`
done
when I execute it I get the following error message:
./test1[4]: $i: unknown test operator
Does anyone have any idea why?
When I do an ls on the directory where I execute the script I now have two listings. Both the script test1 and a blank file called file0.
Any ideas are greatly appreciated.
Shaun Aldrich
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2000 12:47 PM
08-21-2000 12:47 PM
Re: Script to create 200 test files in my directory with a timestamp different by 1 second or so...
I just created the following script and called it test1.
#!/usr/bin/ksh
i=0
while [ $i -lt 200 ]
do
touch file${i}
sleep 1
i=`expr $i + 1`
done
when I execute it I get the following error message:
./test1[4]: $i: unknown test operator
Does anyone have any idea why?
When I do an ls on the directory where I execute the script I now have two listings. Both the script test1 and a blank file called file0.
Any ideas are greatly appreciated.
Shaun Aldrich
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2000 01:11 PM
08-21-2000 01:11 PM
Re: Script to create 200 test files in my directory with a timestamp different by 1 second or so...
while [ "$i" -lt "200" ]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2000 01:28 PM
08-21-2000 01:28 PM
Re: Script to create 200 test files in my directory with a timestamp different by 1 second or so...
((${i} < 200))
if [ $? = 0 ];then
echo "the exp is true"
[do whatever]
else
echo "the exp is false"
[do whatever]
fi
Tony
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2000 01:33 PM
08-21-2000 01:33 PM
Re: Script to create 200 test files in my directory with a timestamp different by 1 second or so...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2000 01:38 PM
08-21-2000 01:38 PM
Re: Script to create 200 test files in my directory with a timestamp different by 1 second or so...
Silly, but it could be the problem.
Steve