I need to move different files from different folders to a new folder using a command line. The files share the same format .asc
: for example, there are files 20file1.asc
, 20file2.asc
and 20file3.asc
existing in folder1
, folder2
and folder3
respectively. I simply need to move the .asc
from all folders to new folder which is folder4
. Each folder is named following a yyyymmdd
scheme.
Thanks
I would use simple script for that, like this one:
for x in {folder1,folder2,folder3}; do mv $x/*.asc folder4/; done
This script assumes you're in path that has folder1,folder2,folder3 in it. You can tune it up to your needs.
For all folders in specific place you can do:
ls -1 >> file
for x in `cat file`; do mv $x/*.asc folder4/; done
But be aware, that ls -1
will also contain files and if there are also files in that folder, you will get errors for these files, saying that path does not exist.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments