I have tar.gz files accessible from./parent/subfolder/tar_file_folder/*tar.gzAnd I want to find them and move them into the ./parent/ directory, therefore one level up. However, there are several subfolders and tar_file_folders. Therefore, I want to call my command from the parent folders. I have tried this command line:cd ./parentfind -name '*.tar.gz' -exec mv {} /path/to/single/target/directory \;However, I am not quite sure how to specify the path to one level up. Any help?Two examples of path where in this case the tar files has to be either move to ./AU-ASM folder or ./AR-Vir/ folder: ./AU-ASM/besnard.sim@gmail.com-10142016-131638-715/LT51030752011211-SC20161014133947.tar.gz./AR-Vir/besnard.sim@gmail.com-10142016-131706-095/LT51030751995263-SC20161014133510.tar.gzAnd this is an example on where the tar.gz are stored:./Landsat_Data/AR-Vir/besnard.sim@gmail.com-10142016-131706-095/*tar.gzThe command line needs to be run from the ./Landsat_Data/ directory
Find all tar.gz files and move them to a one level down directory
find;tar;move
You could iterate on tar files and move them to parent directory '..', like that:for tar in $(find path -name '*.tar.gz'); do mv $tar $(dirname $tar)/..; done