0
I have to copy files to folder with name with their type using command 'find'. There are a lot of files with a lot of folders. I tried command:
find ./find -type f -exec bash -c ' file -b "$1"|cut -d " " -f 1 ' none {} \;
But I don't know how I can use mkdir to make folder, when I use "|".
I think about two command. First make the folders from type of files. Second copy files to this folder.
But how I can make this folders.
What is the benefit of using
– JakeGould – 2015-08-22T06:03:47.607find
here? Why not usersync
instead to sync content from one folder to another?This is task from studies and we didn't use rsync. – diego9403 – 2015-08-22T06:23:38.583
I found solution:' find ./find -type f -exec bash -c ' file -b "$1"|cut -d " " -f 1 |awk -f aw' none {} ;|xargs mkdir' but I can't copy this file. My command: 'find ./find -type f -exec bash -c ' file -b "$1"|cut -d " " -f 1 |awk -f aw|cp "$1" ' none {} ; ' And error: cp: omitting directory `find/PNG/' – diego9403 – 2015-08-22T09:22:21.443
I am trying copy files to another folder, but I can't. Command:
find ./find -type f -exec bash -c ' file -b "$1"|cut -d " " -f 1 |awk -f wa|xargs cp "$1" ' none {} ;
But I only see error:
cp:
./find/PDF/20163.32630.27874' and
find/PDF 20163.32630.27874' are the same file – diego9403 – 2015-08-22T15:00:57.420