MrEddy
November 9, 2010, 11:58am
1
How could I go about creating some trash files to use for testing. All I need is for files to exist and the data in them really doesn't matter.
I need to do some work and testing with scripts and I don't want to mess with real data in my testing.
So I would like to generate say 10,000 files in a directory.
10,000 files containing what? nothing? garbage? random binary garbage? garbage text? You could tail 1000 lines from a system log and copy it. Or if empty will do, you can just do touch dir/to/file{0..9999}
MrEddy
November 9, 2010, 12:24pm
3
Contents of the files do not matter, they can be empty. I just need a bunch of files.
for N in {00..99}
do
touch ${N}{00..99}
done
should generate empty files in the current directory from 0000 to 9999.
MrEddy
November 9, 2010, 1:28pm
5
Only seems to create one file not 10000 files.
I'm using Bash with Free BSD.
Well, what file does it create? My crystal ball's still in for maintenance.
Here, in BASH, I can do:
$ for N in {1..5} ; do touch ${N}{1..5} ; done
$ ls
11 13 15 22 24 31 33 35 42 44 51 53 55
12 14 21 23 25 32 34 41 43 45 52 54
$
...which is just a reduced version of the script I gave you, creating 25 files of [1-5][1-5] instead of 0000-9999.
MrEddy
November 9, 2010, 3:01pm
7
all I get is one file.
0B Nov 9 11:58 {1..5}{1..5}
Don't buy crystal balls from walmart those things are not reliable. You gotta get it from costco.
---------- Post updated at 03:01 PM ---------- Previous update was at 02:59 PM ----------
Think I got it to work using this.
for (( i=0 ; i < 1000 ; i++ )) ; do touch $i ; done
You've got a pretty bizzare configuration of BASH to not support the {1..5} syntax. Are you sure you're not using something else? Or maybe it's really, really old.
MrEddy
November 11, 2010, 12:55pm
9
GNU bash, version 2.05b.0(1)-release (i386-unknown-freebsd5.3)
Copyright (C) 2002 Free Software Foundation, Inc.
danmero
November 11, 2010, 1:17pm
10
touch file{0..9}{0..9}{0..9}{0..9}
GNU bash, version 4.1.7(2)-release (i386-portbld-freebsd7.3)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
pludi
November 11, 2010, 1:51pm
11
That's quite old. I think the syntax Corona mentioned was introduced with Version 3.