Arrays - Raspberry Pi Forums
hi guys! new here. go doing arrays , scripting. i'm little stuck on creating script can read files of home directory array using code arrayx=( $( ls. ) )
has display empty files, directories, , files not empty. sorry new this, , stumped me. have been looking while , have not found anything. have create backup script copy directory input script location input script. if makes sense. in advance!
has display empty files, directories, , files not empty. sorry new this, , stumped me. have been looking while , have not found anything. have create backup script copy directory input script location input script. if makes sense. in advance!
quite few things there, try breaking down bit.
i'm assuming bash being used of these.
create arrary of in current directory using ls (hidden files not listed)
far got.
create array of empty files (0 length, real files) in current directory (filenames prefixed "./" , hidden files shown)
create array of non-empty files (not 0 length, real files) in current directory create array of directories in current directory (just top-level) create array of directories in current directory , deeper, ones in same filesystem. backup scripts, @ rsync command. powerful doing backups, both remote , local.
i'm assuming bash being used of these.
create arrary of in current directory using ls
code: select all
x=( $( ls ) )
far got.
create array of empty files (0 length, real files) in current directory
code: select all
x=( $( find . -maxdepth 1 -size 0 -type f ) )
create array of non-empty files (not 0 length, real files) in current directory
code: select all
x=( $( find . -maxdepth 1 -size +0 -type f ) )
code: select all
x=( $( find . -maxdepth 1 -type d ) )
code: select all
x=( $( find . -xdev -type d ) )
raspberrypi
Comments
Post a Comment