bash - Randomly create files and folders size of in 1M, 10M, 100M, 1G, 10G -


i have searched lot couldn't find solution this.

insida folder, how create random files , folders size of in 1m, 10m, 100m, 1g, 10g. each created folders needs have randomly created file in it.

you use dd different file sockets, e.g. /dev/random or /dev/zero.

this create 2mb file random data in it:

dd if=/dev/urandom of=file.out bs=1m count=2 

or create 1mb file /dev/zero:

dd if=/dev/zero of=file.out bs=1024 count=0 seek=1024 

there lot of examples out there, search "linux dd create file size". should wrapped in script create directories , files you. think of this.

#!/bin/bash #create files of 1, 10, 100 , 1000mb in size fsize in 1 10 100 1000 #create file size 1mb*fsize dd if=/dev/zero of=file.out bs=1024 count=0 seek=$((1024*fsize)) done 

combined script create directories , fsize loop should want.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -