I've bunch of folders in folder A
. I want to move files from all those folders to A
.
Or
I want to cut all files from child folders and paste them in parent folder.
How to do that?
I've bunch of folders in folder A
. I want to move files from all those folders to A
.
Or
I want to cut all files from child folders and paste them in parent folder.
How to do that?
Go to your
A
directory and runwhich means "find all files in this directory and its sub-directories and execute mv with target directory . for each file found to move them to current directory.
Well you could create a file and name it "cutme" (to create a file called cutme in the terminal type
nano cutme
. To save it press CTRL+X then press ENTER.) for example and paste the following in it assuming that:find * -type f -print -not -type d -and -not -regex 'cutme' -exec mv {} .. \;
Note the name cutme inside the line. It should be the same as the script you will run.
After creating the file and pasting the above line, run the following in the same folder as the script:
chmod +x cutme
. This will give your new file the "Executable" flag so you can execute it like this:./cutme
.