merge contents of folders
Hi,
I have alot of different folders with alot of files inside of them my question is, is there a way I can take the contents of these folders and merge them into one folder? other wise i have to go through them one by one and it is gonna take a long long time there are about 150 folders and probably about 15000 items inside of them. i have tried a few things but but none seem to work. Thank you in advance |
You can use the mv command. Just be careful to not overwrite an existing file/folder.
Examples are here: http://www.linuxcommand.org/lts0050.php http://members.toast.net/art.ross/Li.../command3.html Basically to move one directory/folder/file to another (bold italics is example output listing): Code:
$ ls Code:
$ ls |
Depending on the complexity of the hierarchy, you may need a script.
For example, suppose DIR_1 has a bunch of files that you want to move to DIR_2: in DIR_1, "mv * DIR_2" will move everything---but it will also move any directories. (That may be OK in your case) |
It is pretty messy. Been trying to write a script but i cant think of a way to do it. the way that have been show is the way i had been doing it and it was taking forever.
It matters not now, I have done it and it took a while lol. Thank you anyway. |
cd /path/to/base/dir
Code:
find ./ -type f Code:
find ./ -type f | xargs mv --target-directory /path/to/some/storage/dir |
Thank you i will keep that for future reference. No need to be sorry it wasnt so bad and it encourages me to learn more.
Thank you |
All times are GMT -5. The time now is 01:21 AM. |